eatgrass / obsidian-pomodoro-timer

A pomodoro timer that helps manage your daily focus
MIT License
92 stars 5 forks source link

High CPU usage when clock is opened #50

Closed zanqi closed 3 weeks ago

zanqi commented 2 months ago

When the clock is opened:

image

When the clock is hidden, but it is still counting down, just hidden:

image

CPU is much higher when the clock is shown.

djungelsk0g commented 1 month ago

I love this timer so much but I find this to be a massive problem. I'm a Uni student who likes to play games so I have a gaming laptop, this thing is already SO bad with getting too hot and the fans get very loud when it gets hot.

When the timer isn't active and I have: Spotify (miniplayer open), my browser (multiple tabs open, playing video), and obsidian open, my CPU usage is at about 10%. when I start the timer, it jumps to about 30% and after 10-20 minutes of it my CPU gets to 95°C and the fans start going crazy.

It really puts me off using this plugin and I've been looking for other solutions but none of them even come close to this one. Please fix it if you can! It would be greatly appreciated!

I'm definitely not an expert, and if I'm being stupid, I apologise but you're maybe running too tight of a loop? This Stack Overflow thread talks about high CPU usage with running timers and one answer was that if you make the loop which checks for updates too frequent, it uses a lot of processing. With an inexperienced glance at your code (not even sure if that parts I looked at were right lmao) I don't see any sleeps or delays or anything and so that's why I thought that this might be your problem??

I'd be kinda suprised if this helped but i hope it does! Thanks :)

eatgrass commented 1 month ago

I added an option to lower fps of the timer animation in 1.2.2, let me know if it works for you

zanqi commented 3 weeks ago

It's still high.

image

Is it possible to do css animation? https://developer.mozilla.org/en-US/docs/Web/Performance/CSS_JavaScript_animation_performance

djungelsk0g commented 3 weeks ago

It works pretty decently for me! I thought I'd quickly record my average CPU usage rate: just obsidian and a performance analyser open, the timer is in the right sidebar.

Sidebar Expanded Sidebar Collapsed
Low FPS off 19% 12%
Low FPS on 15% 12%