nimiq / vue-components

Vue component library for Nimiq ecosystem apps.
https://nimiq.github.io/vue-components/
Apache License 2.0
17 stars 4 forks source link

Timer: reduce cpu load #82

Closed danimoh closed 4 years ago

danimoh commented 4 years ago

Reduce cpu load by running code just at the required interval.

I will also performance improvements to the Keyguard PR.

sisou commented 4 years ago

Was the RAF running continuously before? And now only during an animation, which in turn only runs on an interval?

danimoh commented 4 years ago

A rAF was running continuously before but only rerendering when animating the radius or after _updateInterval time passed. This has now been decoupled into an interval and a rAF. Repaints are mainly handled by the interval unless the radius is being animated which is done with a rAF that runs only during the animation.

The interval in the expanded timer state at the size we use in the Hub and a timeout of 15 minutes runs approximately every 4s.