phetsims / number-line-integers

"Number Line: Integers" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 4 forks source link

Recording Performance #69

Closed KatieWoe closed 4 years ago

KatieWoe commented 4 years ago

Testing performance on: https://phet-dev.colorado.edu/html/number-line-integers/1.0.0-dev.10/phet/number-line-integers_all_phet.html

Platform FPS Subjective Test
Win 10 Chrome 51-60 Good
Win 10 Firefox 50-60 Good
Win 10 IE 52-60 Good
Mac 10.15 Safari 57-60 Good
Mac 10.15 Chrome 54-60 Good
Mac 10.11 Safari 49-60 Good
Chrome OS 32-49 Poor
iOS 11 40-60 Okay
iOS 9 15-40 Very Poor
KatieWoe commented 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. someslowdown

jbphet commented 4 years ago

@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.

KatieWoe commented 4 years ago

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.

jbphet commented 4 years ago

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: image

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.

jbphet commented 4 years ago

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.

KatieWoe commented 4 years ago

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.