-
Notifications
You must be signed in to change notification settings - Fork 5
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
Rapidly changing the source separation wrecks performance #316
Comments
You can simulate the same problem by clicking the wave source on and off many many times. There is a bug in |
The aforementioned fix corrects a memory leak and allows TemporalMask entries to be pruned when they have left the window. However, rapidly dragging the source separation slider or pressing the on/off button can still swamp the TemporalMask with deltas. More than 20 or so kills performance on my Mac Chrome. The performance is restored in 15 seconds or so when the wave has moved out of the visible region. @arouinfar and @ariel-phet how do you want to address this problem? Here are some possibilities:
This issue blocks next round of dev testing, please let me know your thoughts or reach out to me on Slack/Zoom to discuss further. UPDATE: I added some bullet points. |
Also, @arouinfar I wonder if this is what you observed when the performance dropped on the Chromebook you tested. |
This is just not a pedagogically productive action at all (rapid changing of separation). It seems perhaps keeping only the last 5 or so deltas is a good solution. Basically, I am fine with a solution that allows performance to remain, but if things look a bit odd with you moving the separation slider back and forth rapidly, I am fine with that, since it is not a productive interaction (and it should be a rare interaction). |
@samreid I'm fairly certain this what I was seeing yesterday on the Chromebook. Perhaps I wasn't always changing separation rapidly or often enough to see it happen consistently. I agree with @ariel-phet. Rapidly scrubbing the separation slider serves no pedagogical purpose, and would be a rare interaction. Keeping the last 5ish deltas also sounds reasonable to me. I do wonder what would happen in the lattice, though. Would part of the lattice clear itself when the 6th delta occurs? |
Yes, the temporal mask would "forget" the parts furthest from the oscillator. You can see it in practice on phettest: http://phettest.colorado.edu/wave-interference/wave-interference_en.html?ea&brand=phet Try the following tests: Test 1
Test 2
Please let me know your thoughts. |
@arouinfar and I decided to try 10 deltas. Also to address the artifacts: (1) When the separation slider knob starts to move, clear the wave area and intensity samples and keep them clear until the slider knob is released at the new frequency. @arouinfar and I agreed that @ariel-phet and probably also @kathy-phet would need to sign off on this before I begin investigation. Please see #316 (comment) for instructions how to replicate some of the odd behavior. |
@samreid I think given the nature of this issue (rare use case), dealing with the artifacts can be deferred until after 1.0 is published. |
@ariel-phet while rapidly changing the separation and/or on/off state is a rare use case, the artifacts created by clearing the wave after 5 (or 10) deltas are not at all rare. Each increment the slider thumb snaps to (100 nm for light, or 1/35 of the slider range) would correspond to a single delta. A single adjustment of the separation from a high to low value would correspond to many deltas, which creates a ton of noise in the lattice. The noise will eventually die down, but only after several seconds of sitting around and waiting. You might want to take a look at master for yourself, but here's a gif. (Dimensions are small because of GitHub limit on file size.) |
The above commits "mute" the sources while the separation is being changed. This was easy thanks to the pre-existing support in NumberControl, thanks @pixelzoom! Setting the amplitude to 0 in each frame created odd artifacts at the wave sources, and would have required more complex logic to suppress deltas from the temporal mask. Instead I tried the simpler solution of just skipping setting point source values altogether. There is still an artifact when the wave value immediately stops oscillating, but this solves the problem when continuously changing the source separation, and also prevents those values from entering the list of deltas. @arouinfar can you please test in master? |
A few fixes for water drops in the preceding commits. |
@samreid I think things are generally looking a bit better, though I do find the artifacts in the lattice to be pretty distracting. I'm not so sure the sim is behaving as proposed in #316 (comment). Here, the only adjustment I made was a smooth slide from high to low separation. The lattice unexpectedly cleared, and the lattice ended up pretty noisy and took a bit of time to settle. I'm now leaning towards the first option proposed by @samreid in #316 (comment):
I think this would be somewhat similar to how we handle frequency changes for light, or how we clear the right side of the lattice when the barrier is moved. |
I pushed a commit that suppresses waves while the separation is changing. @arouinfar can you please review on master? On second thought, I'll publish a dev version: Noted: Sound particles "freeze" while dragging the source separation slider. UPDATE: I'd like to fix the particles freezing, will commit shortly. Please hold off testing. |
This version clears the sound particles. Ready for testing |
@samreid this is looking much cleaner to me. I like it! |
Even before increasing the lattice size, it is possible to make the simulation unusably slow by:
Discovered during #315
The text was updated successfully, but these errors were encountered: