Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it faster / don't freeze the UI #17

Open
ttencate opened this issue Aug 4, 2014 · 2 comments
Open

Make it faster / don't freeze the UI #17

ttencate opened this issue Aug 4, 2014 · 2 comments
Labels

Comments

@ttencate
Copy link
Owner

ttencate commented Aug 4, 2014

Currently, the sound is synthesized all in one go. For long sounds, this leads to UI freeze and bad user experience.

There is already some code to do the work in chunks, and set a 0 millisecond timer to start the next chunk. This worked, but I noticed that this slows down generation of short sounds significantly. Maybe we could use a dynamic chunk size, and run synchronously if that would give acceptable latency, asynchronously otherwise.

I also tried web workers, but there are some problems. You cannot interrupt a web worker unless it's going through its message loop, which means we need to run in chunks inside the web worker as well. Alternatively, we could kill the entire worker and start a new one, but a garbage collection bug on Chrome made the tab crash after some 50 workers had been created. We could also have a pool of workers, and just let old ones run to completion, wasting some CPU.

@ttencate ttencate added the bug label Aug 4, 2014
@ghost
Copy link

ghost commented Aug 5, 2014

Some UI work definitely would be appreciated!

I have a humble 1.7 GHz dual-core laptop and whenever I have jfxr open, its tab takes up about 40% CPU in Chrome, even when jfxr is sitting idle. UI isn't smooth at all for me, but functionality-wise it seems to work fine. I have a feeling that it could be made much, much more responsive, and a constantly-running timer as mentioned above is probably contributing to the high CPU usage.

@ttencate
Copy link
Owner Author

ttencate commented Aug 5, 2014

You could try disabling the frequency analyser (left of the play button) by clicking it to toggle it off. It's puzzling that idle takes so much CPU -- I've poked at that a bit, but even if I remove all drawing code except the canvas clear, CPU is still high.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant