YouTube Lag follow-up
So, as you know, I'm experiencing an issue where enabling YT+ seems to impact pages on YouTube. Minor lag is present that only worsens the longer Chrome is opened. This includes issues such as: lagged scrolling (not smooth) and videos taking slightly longer to actually play (sometimes). Trying to click on things within the page can also be lagging (also sometimes). From what I've seen, this lag appears to be most noticeable when playing videos in a Playlist. I don't seem to notice it too much when not playing videos.
I use Google Chrome and it's the 64-bit version (52.0.2743.116 m)
YT+ is up-to-date
Things I've tried:
Disabling every extension but YT+ Turning off "use Hardware Acceleration when available" option within Chrome Creating a new user profile Resetting Chrome's setting to default Disabling settings within YT+ to see if one of them was causing the problem
Computer specs:
AMD Athlon x4 860K @ 3.9GHz Nvidia GTX 750Ti MSI GPU 8GB DDR3 RAM Windows 7 Ultimate 64-bit SP1 7200RPM 1TB Hard drive
I've tried a ton of things and honestly nothing seems to help. The only fix that returns everything to normal is turning off YT+
This problem does not occur when using other extensions (Magic Actions, ImprovedTube etc). This also does not seem to occur on Mozilla Firefox. It looks like it's an issue with Chrome. Maybe it's the version I'm using?
Your description sounds like a memory leak that is occurring, the only thing that comes to my mind is that somehow YT+ could be looping itself, either by running more than once on the same page, or a function that is referencing itself. If it is happening to you then it is very likely others might be suffering the same problem, so fixing this is important in more than one way.
From what I understand you are using the extension version from the Chrome webstore, and I assume that you are using the latest version 1.4.8. Now for the next step we will try to find out whether the problem is with something in the extension version or in the YT+ core script and for that I would ask that you try the userscript version with Tampermonkey.
For this first install the Tampermonkey extension and then click on the GitHub userscript version available here: https://github.com/ParticleCore/Particle/wiki/Download
Tampermonkey should detect it automatically and ask if you want to install it and proceed to doing so.
Remember to disable the YT+ Extension version, otherwise you will have two YT+ running at the same time.
Restart the browser and see if the same lag still persists with the userscript version, if it does or doesn't then we already ruled out one probable cause. I will wait for your results.
The same happens with Tampermonkey as well.
So we can now assume that the cause is connected to the YT+ core script and not with the extension dependencies. We will move on to the next steps.
When the lag starts getting noticeable again open the console by pressing Ctrl +Shift + J and see if there are any messages posted on the console tab, and if there are paste them here. After that (in that same console) click on the Elements tab, collapse the <body..> element (grey arrow on the left of the element) and take a screenshot of the HTML structure and post it here. Like so:

Remember to collapse the body element.
Also take a screenshot of the Chrome task manager. With Chrome selected/active press Shift + Esc to open the Chrome task manager, take a screenshot of it so we can see how much memory is being consumed.
Additionally show me a screenshot of your YouTube page (the home page is enough and it doesn't have to be the entire page, just most of it) to confirm that you are not receiving some sort of new YouTube feature that could be causing this (very unlikely after all the steps you took, but it is best to confirm).
And I need to ask, but have you been doing your tests with YT+ default settings or have you been changing them before each test?
Console tab: http://puu.sh/qGYJi.png
HTML5 structure (think it's the right one): http://puu.sh/qGYUW.png
Chrome Task Manager: http://puu.sh/qGZ7s.png
YT page: http://puu.sh/qGZ9c.jpg
I'd like to add that this lag is always there. It gets worse if Chrome has been opened for a long time, but even if you open Chrome again, I can still notice the lag. All I have to do is test the scrolling to see if the lag is there. There is quite the difference between the smoothness of scrolling with YT+ enabled and with it disabled, with the disabled one removing the lag and returning the scrolling to its intended smoothness.
I've also been performing the tests with most of the default settings. The only option I disable is "player visible when reading comments".
The Firefox version doesn't appear to give me these issues. Scrolling is smooth as ever with YT+ enabled.
From the technical pov everything appears perfectly normal, no signs of anything that might be causing lag from YT+, the console messages are from blocked ads, but there are a lot of extensions that might be incompatible with YT+. You said that you already tried with everything disabled except YT+, did you remember to restart Chrome after disabling the other extensions? All of them, not just the ones you think can cause conflict, there have been users that just disabled a few thinking all the rest wouldn't matter and it ended up being a conflict caused by the extensions they did not disable.
At this point I am running out of ideas, but I can still try to replicate the problem by installing the same extensions you have and look for the scroll lag you mentioned.
And this is a long shot, but how many subscriptions do you have? I ask this because there was an issue with having too many subscriptions a while back (unrelated to YT+ though), just checking if it might be somehow affecting YT+ performance.
I think I might finally be onto something. Just with YT+, while scrolling the CPU usage jumps to 30% (probably hardware bottleneck, otherwise it might go higher), but without YT+ it stays stable at 10% ~17%, quite a difference. I have also used the same settings as you mentioned, default with just the one disabled and was able to notice the CPU overuse, but here is the most interesting part, when I enabled that setting the CPU use was very low, as low as without YT+ installed. I did not notice lag, but the software overhead is very noticeable.
So with these findings I would ask that you test this on your end to see if the scrolling experience improves when you enable that option you have been disabling, Player always visible when reading comments
Let me know if it got better.
For me, the CPU usage still spikes to around 25-30% while scrolling regardless of whether that option is enabled or disabled. If I disable YT+, then scrolling page just spikes CPU usage to around 15-ish (and no lag is present). On Firefox, enabling YT+ and scrolling spikes CPU usage to around 15 as well with no lag present.
This seems to only be happening with Chrome. It's like whenever I enable YT+, a weight is added to the page that's visible when scrolling (it becomes heavier). Turning it off releases this weight, removing that heavy-like scrolling.
It seems like the issue and cause of lag is the CPU usage spike since Firefox doesn't have this issue and doesn't get lagged scrolling/slower video loads.
Yes, I agree with you that it made no difference, my first finding was premature, it still spikes regardless of the feature being enabled or not. I also saw the same results as yours on Firefox, so it is something clearly restricted to Chrome and I can't tell what is the cause but I am at this moment removing every single feature individually until the lag is reduced or gone, hopefully that way I will find what is happening.
I think we have discovered the cause of the lag, at least I was able to replicate it on my end, so for now there is nothing else I need from you. Once I have any result I will post them here to let you know, I just hope this isn't some Chrome like feature that they decided to make default and somehow is causing this strange situation.
I think I found the reason, but I don't know why it causes lag. Test this with the userscript version.
Opening the console again, in that Elements tab delete the style element that is on top of the list, just that one, simply right-click it and select "Delete element". Close the console and try the scroll, is it still lagging?
@SingularityRS So from my research this appears to be the remnant of a 6 years old bug in Chrome for fixed positioned elements, in this case in pseudo-elements, more specifically the dark background around the player for when Cinema Mode is enabled. What is happening is that this bug is telling Chrome to paint the entire page each time the page scrolls, so it is no wonder the CPU load gets high. I think I found a workaround for the problem, at least now the tests show nothing similar to the previous CPU load, so I would ask that you try the userscript version again to see if the lag is still present.
To force the update of the CSS stylesheet while using the userscript version simply open a YouTube page and press Ctrl + F5
Let me know if it is improved or not.
Sorry for adding an unrelated comment but I just have to say that this was a really interesting read. It's awesome that you're willing to help people with, what seemed at first, a likely unrelated issue so they would have a better experience.
So thank you very much for all the hard work on making YT+ the best youtube addon there is!
So I just re-enabled the Tampermonkey version and it seems like the lag has gone (it's still present on the Chrome extension version). I can confirm the load has dropped as well.
I wonder why this is only happening to me, though. Surely, it would have happened to others as well? Unless there's a specific "criteria" that must be met before this bug shows up.
It is not just happening to you, it is happening to all users on Chrome, this is a Chrome bug that is still passing through the cracks in each version, however it happened to be very noticeable for you and I am sure there are other users that noticed this as well, for example this one did, but didn't reply back since: https://greasyfork.org/en/forum/discussion/10911/
I am glad to hear that the workaround I used for the userscript version worked, so I will update the Chrome webstore extension with that fix so that you can use the extension without lag as well. Will let you know when the update is launched.
The new version 1.4.9 contains the fix for this issue, it should become available for update in the Chrome webstore in the next 30 minutes or less. Let me know if it works for you too when you have a chance to update it.
Also thanks for the kind words @Eisys
Yup. It's gone now, thanks.
Glad it got resolved. It was bugging me and the only thing stopping me from using this extension.
Thanks for being very patient and for all the feedback, without it this would be left unfixed without me knowing that there was a problem at all and what was causing it. Thanks to you, others that were under the same circumstances now have this fixed too and future users will not be affected by this.
Also, whenever you have some time, I would really appreciate if you could update the feedback you left in the extension reviews since the problem has finally been solved.