optimize cpu usage by reducing the timer redraw frequency#141
Merged
Splode merged 1 commit intoSplode:masterfrom Jan 7, 2021
Merged
Conversation
Owner
|
Great optimization, thank you! Good point about hardware acceleration, too. I don't actually think that we need hardware acceleration, so I will look at disabling it by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that when the timer is started, animejs causes electron to redraw the main window at 60FPS rate.
Such speed doesn't come for free and results into very a high CPU usage on many systems
This PR replaces
easing: "linear"with a custom easing function that reduces precision of returned "progress" to 3 digits (thus resulting into 1000 of redraws per full timer cycle)I guess it should also fix #135
I also noticed that disabling hardware acceleration allows to save some extra CPU usage (Ubuntu 20.04 with Intel graphics). Probably might be a good idea to add such an option into the settings dialog.