-
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
Optimize energy chunk performance #75
Comments
So that we have a baseline against which to compare, I'm gathering some data on performance on my Dell XPS running Windows 10. When I do this at full screen on the main display, I'm currently seeing around 38 FPS when showing the sun (which creates a lot of energy chunks) and the beaker (which contains a lot of energy chunks). Note that the conversion from light to electrical energy on the solar panel is not currently working. Here is a screenshot: Profiling shows that a fair amount of time is being spent getting the reflective shape of the clouds, which seems odd. Here is a screenshot that shows a "flame" where over 25ms is being spent on this: @chrisklus and I discussed this, and he is going to investigate optimizing this code. |
Also, the energy chunks are being created frequently and consist of a composite node with a background and a text element. We may get some performance increase by making this an image and reusing one image per energy chunk type. @chrisklus is also going to investigate this. |
The clouds' ellipses are now only drawn when their position changes, and the energy chunk image nodes are only created on initialization, instead of every time a new chunk is needed. Before these changes, on the iPad Air 2, the sim was running at 18 fps when the sun was showing with energy chunks coming out of it. After making the cloud change, it ran at 29-33 fps, and after the image node change, it runs at 40-41 fps and looks pretty nice. @jbphet and I are going to discuss if any further optimization needs to be done for the energy chunks. |
@jbphet and I are going to do a bunch of profiling on different devices before making this decision. |
Closing, see #191 for latest performance updates. |
Profiling has shown that positioning and rendering of the energy chunks is pretty expensive, we need to investigate how to improve the performance of this portion of the sim. One possibility is to use a canvas, but that may prove problematic due to the use of layering.
The text was updated successfully, but these errors were encountered: