Skip to content

optimize cpu usage by reducing the timer redraw frequency#141

Merged
Splode merged 1 commit intoSplode:masterfrom
aliaksei-siarhei:reduce-timer-redraw-frequency
Jan 7, 2021
Merged

optimize cpu usage by reducing the timer redraw frequency#141
Splode merged 1 commit intoSplode:masterfrom
aliaksei-siarhei:reduce-timer-redraw-frequency

Conversation

@aliaksei-siarhei
Copy link
Copy Markdown
Contributor

@aliaksei-siarhei aliaksei-siarhei commented Jan 5, 2021

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.

@Splode Splode merged commit 530031f into Splode:master Jan 7, 2021
@Splode
Copy link
Copy Markdown
Owner

Splode commented Jan 7, 2021

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.

@aliaksei-siarhei aliaksei-siarhei deleted the reduce-timer-redraw-frequency branch January 8, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uses a lot of CPU

2 participants