Eric Ransom Writing Projects Other Stuff Contact

Header image


Terrible popular websites waste your CPU and energy


SUMMARY


I tested the CPU usage of having a website open in Firefox in the background and leaving it idle for 10 minutes. No other applications were running except for a terminal emulator which was the selected window during the test.

Websites varied greatly in the amount of CPU used. Some particularly heinous sites use a huge chunk of CPU contantly and indefinitely until the site is closed.

This shows that simply having an inefficiently-designed website open in the background can drastically increase CPU load, leading to increased energy consumption/battery usage and less CPU resources for your other applications.


A bar graph showing the results of the tests described below.  The graph shows a dramatic CPU usage increase between different websites idling in the background


METHOD


I ran this test on an older (2017ish) laptop running Linux Mint using only 2 running applications: Mozilla Firefox and the Kitty terminal emulator. To measure CPU usage, I used mpstat from the sysstat package.

Firefox had only one open tab which was used to load the website being tested. All browser extensions were disabled. All autoplay for both sound and video was disabled. Even though this reduces total CPU usage (significantly in some cases), I wanted to ensure a fair test where no audio or video was being played across all sites. I verified this for each site outside of the test conditions stated below. I was also not logged in to any of the sites while testing.

I polled CPU usage across all cores every 1 second for 10 minutes. The results in the image above and results below show the average CPU usage across all cores over that 10-minute period.

As soon as I executed the mpstat command, I refreshed the website being tested in Firefox. I then immediately tabbed back over to the terminal emulator and let mpstat work with the terminal in the foreground.

Websites were not selected in a rigorous way. I simply tested whatever came to mind and selected some other sites off a "most-visited in the US" website list. I tried to select multiple example sites from the same "category" of site for comparison's sake (e.g. both Google and DuckDuckGo, both the Guardian and Bloomberg, etc). I also tried to exclude complex web applications that have a real reason for using substantial amounts of CPU to do client-side processing, for example.


RESULTS


Full output files for the CPU polling for all tests are linked at the bottom of the article. This section contains a short summary for each site tested.


EricRa (ericra.com) - 0.92%

This was my "control" site since my site is as simple as possible and basically does nothing once text and images load. Predictably, CPU load drops off dramatically after page load and stays constant near zero for the remaining time.


ChatGPT (chatgpt.com) - 1.04%

This one was a bit surprising. Turns out that this site mostly leaves your computer alone when not you're not engaging with the LLM.


DuckDuckGo (duckduckgo.com) - 1.05%

Same here. Nothing much happening. All good.


Wikipedia (en.wikipedia.org/wiki/Main_Page) - 2.01%

Lots more content displayed here than previous examples, but the site stops using CPU once all static content is loaded. So no issues with this.


Hacker News (news.ycombinator.com) - 3.59%

This usage was a little higher than expected. Not bad at all given the examples below, but I did find it curious that usage was higher than the main page of Wikipedia.


The Guardian (www.theguardian.com/us) - 6.65%

I consider this usage to be very good for the amount of content displayed. This shows that not all news/media sites need to necessarily be a huge, bloated mess.


CNN (www.cnn.com) - 8.72%

Ok, we're starting to get up there a bit in usage, but no big deal. This is still quite low for the amount of content displayed.


Fox News (www.foxnews.com) - 16.37%

We're suddenly jumping up to nearly double the usage of CNN here. Again, a reminder that autoplay was completely disabled for all sites, so there are no videos or sounds playing during the testing period. One starts to wonder what the sites are doing during this period. I saw no evidence when reviewing the various news sites that ones update substantially more frequently than others without refreshing the page, but this is not something I tested for. So I can see no charitable user-driven explanation.


Google (www.google.com) - 17.01%

I had to re-run this one to believe it. Why the hell is this site using so much CPU when it's essentially (from the user perspective) a blank page with a single search box? You can also see from the output that the CPU usage is nearly constant during this period. Given the number of page visits a day and the potential amount of idling time worldwide on this site, how does Google justify this amount of waste?


Bloomberg with ublock Origin (www.bloomberg.com) - 29.49%

Here we start to get into territory where websites are just abusing your computer. I wanted to test at least one of these sites with ublock origin enabled to see if it would help matters by blocking various adtech-related calls, etc. But as you can see from the following listing, it didn't help at all regarding overall CPU usage. I did short tests with some of the other sites are observed similar results.


Bloomberg (www.bloomberg.com) - 29.50%

In this case at least, ublock origin didn't do anything to help CPU usage. See above.


Daily Mail (www.dailymail.co.uk/ushome/index.html) - 31.84%

The worst of the bunch tested. This website design is simply offensive, even disregarding the content (which is, as a bonus, just generally offensive to humanity).


CONCLUSION


These simple tests demonstrate that you can cede control over a large % of your computer's processing power simply by leaving a poorly or maliciously-designed website open in the background.

One important note is that these results only seem to be this strong when the tab is "active" in the browser for many sites. If you run the tests under the same conditions but a second, empty tab selected, CPU usage for some sites plummet. This is an explanation for how some people keep hundreds of tabs open while still having a functioning PC. It does show that for people using many tabs, the tab you have active can make a significant difference even if the browser is not the current active window in the OS.

I did not go into detail to examine the cause of the CPU usage for these sites, as that was just beyond the scope of this little experiment. Maybe i'll look into that later on. I have to suspect that much of it can be explained by making sites increasingly complex mainly to serve ads. Ublock origin can block network requests and elements from being displayed, but it can't do anything about the site infrastructure being designed in a complex way to accomodate the constant serving of ads and trackers.


TEST OUTPUT


Bloomberg with ublock origin enabled

Bloomberg

ChatGPT

CNN

Daily Mail

DuckDuckGo

ericra.com

Fox News

Google

The Guardian

Hacker News

Wikipedia

Published: October 31, 2024.
Last updated: October 31, 2024
Correction and Edit History:
*License Info: This article is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

Licensed under CC BY-SA 4.0