zazu
zazu copied to clipboard
Resource usage
Expected Behavior
No resource usage when idle in the background
Actual Behavior
zazu 0.4 is consuming cpu, when no window is launched
Steps to reproduce the behavior
Disable every plugins but tinytacoteam/zazu-calculator, to be sure that no plugin is doing background tasks. Monitor zazu energy impact in activity monitor.
Versions
- Zazu: 0.4
- OS: MacOS 10.12.3
maybe due to the setInterval in Notification.
If you don't mind making a few custom builds, I'd love to try out a few things.
- Notification like you said does have a setInterval, so it would be interesting to remove that interval for a test. I think this is unlikely however, but if this is the case we could increase the interval to a higher number.
https://github.com/tinytacoteam/zazu/blob/b35090b75d481077585e701aeb667ced05c60f6a/app/lib/notification.js#L27-L31
- We "resize" the launch window every 125ms. We should take this out and try it as well. This will make zazu look a little off. The fix here is to either add more conditions before doing any javascript, or have the window communicate out that the size has changed instead of polling it constantly.
https://github.com/tinytacoteam/zazu/blob/1631cee39db3fdcde910fbedf962fbaae853b161/app/helpers/window.js#L19-L24
Lastly, If neither of these work it's possible to take a profile via the dev tools in zazu that could reveal what code is running.
If I comment both setInterval, resource usage goes down significantly.
I think I can remove the setInterval in Notification and replace it by two call to tick() while keeping its functionality. Or I misunderstood the goal of the setInterval. Can you clarify that to me?
For the setInterval in windows.js, can we clearInterval() when the window is hidden ? and re activate it when zazu is visible ?
Also, how can I run the profiler (to get the eventual remaining spots for improvements) ?
Yes, exactly they can both be reduced greatly. I like your idea for doing it in window only when the window is active. A simple open/close listener could do the trick.
Notifications can do something similar when we only have an interval when there is a queue. A pr would be appreciated! :D
Not sure if I should start a new issue, but I have noticed excessive RAM usage when this is running in the background. I'm talking like 3GB.