Closed KatieWoe closed 4 years ago
Some slow down happens if you move both piggy banks at the same time with the buttons. Screen recording makes the problem worse, so it isn't as bad as shown. On Win 10 Firefox fps drops to about 43 while doing this. Minor issue.
@KatieWoe - can I get more information about what was being done when the FPS number in the table above were recorded? My own testing shows 60 fps all the time unless some user interaction is occurring, which is what I'd expect, so I'll need to know what you were doing if we want to try to improve it.
Using touch, use 1 finger to push a button that moves one bank. Simultaneously, use another finger to push a button that moves the other bank.
I profiled this on Chrome and it looks like the most time is being taken up in the coin animation, specifically creating and adding the coin nodes.
I ran a test where I set up the in the configuration shown below, pressed and held the enabled buttons (withdrawal for the top account, deposit for the bottom) and watched the FPS measurement for the lowest value that occurred during the time that it takes for the banks to transition from one side to the other. I did this on my Win 10 Dell XPS, at full screen size on the main screen, which is high resolution. In a Chrome incognito window, the lowest value was 57 FPS, which wouldn't be anything to worry about. However, in a Firefox private window, it dropped to 19 FPS.
Starting config:
I'll try caching the coin images so that they don't have to be recreated and added each time and see if that improves things.
I've added an optimization that pre-creates and caches the animated coins, and my testing shows that it gains about 5 FPS on FireFox, which is about a 25% improvement. This isn't exactly amazing, but it's better than nothing, and might do better on some of the other platforms.
Any more optimization would take more time, and I don't think the use case really warrants it at this point, so I'm assigning back to @KatieWoe, and she can test on the next dev or RC version.
I still see about the same fps drop during https://github.com/phetsims/number-line-integers/issues/69#issuecomment-564678051 in rc.1. However, I didn't see any effects and I think this can be safely closed. @jbphet please close if you agree.
Testing performance on: https://phet-dev.colorado.edu/html/number-line-integers/1.0.0-dev.10/phet/number-line-integers_all_phet.html