YouTubeAlchemy icon indicating copy to clipboard operation
YouTubeAlchemy copied to clipboard

High CPU usage when watching videos

Open jaypikay opened this issue 10 months ago • 12 comments

If I try to watch a video using Firefox 147 with the extension enabled, the CPU load goes up to +320%. Video playback stops, audio continues for a short time, UI elements do not react and closing the tab takes a while.

After closing the tab the process is still active and continues to consume 100% CPU (in about:processes)

Disabling the Extension the performance is sub 100% and playback is good.

Currents settings: https://pastebin.com/THABZ9nK

Example Video: https://www.youtube.com/watch?v=ICJfHlnVP9o

jaypikay avatar Jan 21 '26 19:01 jaypikay

I also had to deactivate the plugin, because otherwise my (older) PC would freeze completely and become unusable. Seems like they changed something in the background which causes the extrem CPU load.

GoodSoulGermany avatar Jan 22 '26 12:01 GoodSoulGermany

Thanks for the report!

I tried to reproduce this with the current public version on Firefox 147.0.1 (aarch64), using your example video and imported your settings. On my side, playback is smooth and Firefox stays between ~5-15% CPU while playing the video and drops to ~1% when I hit pause.

Two quick questions:

  1. In about:processes, which exact entry shows above 300% CPU?
  2. Are you on desktop Firefox or mobile, and what operating system are you using?
  3. Make sure you only have one instance running, either the userscript or the browser extension, not both.

Another user reported that disabling "Custom Selection Color" helped on their system.

Otherwise, disabling these might help:

  • "Use Enhanced Bitrate for 1080p Videos"
  • "Sort Notifications Chronologically"
  • "Prevent Autoplay"
  • Playback speed
  • Subtitles: set back to "Auto"

Also, if your YouTube display language is not English, please switch it to English and test again.

As a last check: disable all features. In that state, the script only injects the CSS, runs through the config, and adds the settings button.

TimMacy avatar Jan 22 '26 13:01 TimMacy

I am on Arch with desktop Firefox 147.0.1.

Image

Thank you for responding. I have disabled you suggestions, that actually helped.

After that, I re-enabled each option and tested the playback for each step.

I have noticed, that enabling "Playback Speed" will cause the high cpu usage.

With just Playback Speed disabled

Image

everything is as it should be.

jaypikay avatar Jan 22 '26 14:01 jaypikay

Thanks for narrowing it down. Do you have any other extension/userscript that controls playback speed? The issue might be two scripts fighting over playback rate control.

TimMacy avatar Jan 22 '26 16:01 TimMacy

uBlock was completely disabled for youtube.com and no userscripts are loaded for the youtube namespace, also vimium which might could have interfered with hotkeys is excluded from youtube.

I will keep an eye on my extensions and continue to test.

jaypikay avatar Jan 22 '26 18:01 jaypikay

Seeing this issue on Win11 X64 - latest patch using both userscript and extension where possible.

tested following the browsers that failed: Helium 0.7.10.1 (Official Build, Chromium 143.0.7499.192) Chrome 144.0.7559.97 Firefox 140.7.0 ESR - userscript only

Firefox 147.0.1 - works - userscript

Settings have been exported from Helium userscript and imported across all combinations.

On this computer all worked OK 22/01/2026, Brisbane Australia, and failed 23/01/2026.

On another machine on same WiFi connection failed 22/01/2026.

Also seeing the same issues as #32

I do not believe it is the CSS injection that is slow as page is reformatted almost immediately.

I also see worse slow down if you reload (CTRL+F5) the page

arogl avatar Jan 23 '26 08:01 arogl

Thanks for the details. I can't test on Windows or Linux, and the minimum supported version is Firefox 142 due to API requirements.

I've made changes to the playback speed function. Please test and let me know if CPU usage drops.

YouTubeAlchemy_9.16.1-test.js

TimMacy avatar Jan 23 '26 10:01 TimMacy

In Helium, it still hangs the page and does not load the sidebar anymore. Previous version would load, eventually but when you started playing the speech was at 2x, but video did not play on Helium or FF147.

It would take minutes to load the settings screen and then hang after importing the prefs.

Copy of my prefs if this helps.

YouTube-Alchemy_v9.16_Backup_2026-01-23T06-49-32-897Z.json

arogl avatar Jan 23 '26 10:01 arogl

After disabling Move "Save" Button into Menu Chrome works again, while Firefox doesn't have that issue for me. I'll need to check the CSS selectors and see what's going on there now.

TimMacy avatar Jan 23 '26 11:01 TimMacy

v9.16.2 seems to have fixed most things apart from missing the speed option in the standard settings of YouTube.

Tested in Helium, Chrome144 and FF147. All 3 working.

arogl avatar Jan 23 '26 12:01 arogl

Tested v9.16.5 (userscript) on FF 140.7.0 ESR and all working.

arogl avatar Jan 23 '26 12:01 arogl

Good, glad it fixed most of it. In v9.16.5, I use a different container to move the "Save" button, that seems to have stabilized YouTube. I also made changes to the playback-speed function, including to safeguard against excessive ratechange events from getting stuck in a loop. The speed option in the settings menu is hidden when Playback Speed is enabled to avoid conflicts.

TimMacy avatar Jan 23 '26 12:01 TimMacy