Open samueljosino opened 5 months ago
Huh, I noticed the CPU usage on Edge but I didn't know it was caused by this ext, thanks for the bug report
I haven't tested this version, let me know if it works better: youtube-time-manager-3.0.13.zip
Just tested both versions, got similar results. Cpu idling at 10%, opening a video on a new tab, it goes up to 40%, then after a bit goes down and sits around 25% on both versions.
I see, then I need to come up with a better way In the new version I had just discovered https://developer.mozilla.org/en-US/docs/web/api/window/requestidlecallback, so I'll try to experiment it tomorrow a bit more and if I don't succeed, I'll try to implement a more manual idle checkup
Did another test without the extension, doing the same test, opening a video a new tab, also got a spike, but this time at 36%, and then settle at 15%-17% while playing the video. So just the extension is using around 10% of the cpu usage
The thing is that as you watch a video, for every https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/timeupdate_event callback, the storage
What I'm thinking of is to only update the data (graphs, lists, etc) according to the storage as the event fires if the current tab is active, though I might need tabs
permission
I made the modification I mentioned a few hours ago: youtube-time-manager-3.0.13.zip Let me know if it works better
According to my testing, if you play the video without the popup being open, the CPU usage is reduced If you play while the popup is open, the calculations for the graphs are being made, which I believe will result in a higher CPU usage
@samueljosino I made another modification, let me know if it works better: youtube-time-manager-3.0.14.zip This time components in which the data object is used will be logged to the console every time the data is sent to them
@samueljosino Can you try out this version? I fundamentally changed how the tracking works DL;DR. instead of accessing the storage multiple times per second, it saves to the storage every minute and in the meantime, it stores it in memory and broadcasts it to the other tabs youtube-time-manager-3.1.0.zip
I am on version 3.1.4 and still see this happening.
It's actually also happening when I open videos in new tabs too (I like to open interesting videos from the suggestions in new tabs to watch later). A new tab will take 100% cpu, the video I am currently watching will not have enough cpu, and the entire computer in general will lag from not enough cpu.
PC Spec: Ryzen 5600X (no overclock), 32GB DDR5 Ram, Nvidia 1070
Edit: I was doing some testing. If I open a video in a new tab and don't switch to it, it will take 100% cpu. If I switch to it, pause the video and come back and continue watching my current video, the 100% cpu goes away for the new tab (according to Google Chrome Task Manager).
I'll try to think of ways to too optimize the data storage
Sorry for the delay in feedback. I've been using version 3.1.4 for a few days now, and I haven't noticed the increase in CPU usage. If it happens again, I'll come here and let you know.
More optimizations could be made, but for now it's good enough
Describe the bug
HIgh CPU usage while watching a youtube video and the extension is on.
How to reproduce
enable the extension, play a youtube video, and increase the video speed.
Expected behavior
high cpu usage
What browser(s) can you reproduce the issue on?
Chrome
What OS does it occur on?
Windows
What's the extension version you're running?
3.0.12
Make sure the bug wasn't reported before
Make sure that YouTube Time Manager is the only extension running on YouTube
Additional context
Im running a Ryzen 7 5800X, iddling at 5% - 10% with a few tabs open on chrome, discord and a few other apps. As soon as i play a video on youtube it goes up to 15% but when i play the same video with the extension, it goes up to almost 100%, making the pc really lag.
I turned the extension on and off a few times, now while playing the video its sitting around 25% cpu usage, still high overall.
But if go back to extremally high usage, im gonna have to stop using it, i dont wanna stop using cause i really like the extension.