High CPU usage on certain website

Sven

14 Jan, 2017 07:20 PM

Hi!

I have the problem that a website I'm spending quite some time on leads to quite some CPU usage of TenFourFox even when apparantly idling (~70-90% on my normal, full profile and ~50-70% on an empty profile) which worries me a bit since it might be that continiously high CPU usage had already lead to the heat death of my previous PowerBook.
The website in question is https://www.fanfiction.net/ or more precisely any story (e.g. https://www.fanfiction.net/s/11049179/1/Frozen-Destiny).
Once I change the tab to something else that definitely uses less CPU (e.g. the TenFourFox start page) then the CPU usage of TenFourFox drops to around 5%.
Also if I use the NoScript add-on the CPU usage drops to 5% as well (so it seems to be related to some script) however then the layout of the story is incorrect (all text is centered) and posting reviews would probably not work either.

I'm using a PowerBook G4e with 2 GB RAM and Mac OS X 10.4.11 with TenFourFox 45.6.0 7450 (though the issue already seems to exist for some versions; I haven't really paid attention to it).

There are four possible solutions at least:
1) Install G4FanControl, which I would recommend for all G4 notebooks, and set the temperature values to 10 °C below the defaults: https://github.com/andreafabrizi/G4FanControl2) Use Adblock, Inspector or any other tool to find the offending scripts that use up the CPU, block them and hope the site still works afterwards.
3) Use YesScript or NoScript to block JS (YesScript is nice because it's uncomplicated and lets you switch on JS if you need it very easily)
4) use Reader Mode to read stories (the little book icon in the URL bar)

I can also replicate this, but unfortunately I think this is a
limitation of our aging hardware. The page appears to run a "save
script" every two seconds, which is why switching away from that
tab reduces the CPU usage -- TenFourFox/Firefox diminishes the
priority of timers on background tabs to save cycles. The impact
seems to be CPU-related. On my MacBook Air the computer can keep
up, but the Quad G5 jumps to around 40% utilization and on my 1GHz
iMac G4 it does indeed run up as high as 90%. The code is embedded
in the HTML itself, so it is probably difficult to block only the
timeouts.

Please note I don't know if that's the only cause of what's
going on with that page. That said, two second timeouts over and
over just to save your reply seems a bit excessive even on a modern
PC, so I might ask the site owner to consider backing that down a
bit. You can point them to this thread if you like.

I agree with Chris that installing G4FanControl is a good idea
anyway. I had an iBook G4 cook itself to death too.

Bit late to this, but in trying to debug why fanfiction.net was causing my (completely unrelated to tenfourfox) browser to go crazy it was the one result that came up in Google, and figured I'd better share my solution for anyone else who gets the same problem

It turns out the problem is NOT the javascript checking for reviews every two seconds, but an SVG animated spinner for Google Translate that for some reason is constantly (about every 15ms) causing the page to redraw, even if it isn't visible.

If you're using uBlock / Adblock / another compatible adblocker, and assuming you don't actually USE Google Translate, the following rules in your custom filters should solve the problem (in short by blocking google translate):

Very interesting. There might not be a whole lot I can do about that, unfortunately; SVG is taxing to animate without hardware acceleration (which we can't enable for various technical reasons with the 10.4 SDK).