title: Iframe irony: Adblock Plus is probably the reason Firefox and Chrome are such memory hogs
url: http://www.extremetech.com/computing/182428-ironic-iframes-adblock-plus-is-probably-the-reason-firefox-and-chrome-are-such-memory-hogs
hash_url: d76938ff6b
Here’s a lovely bit of irony for you: Adblock Plus, which is by far the most popular add-on for Firefox and Chrome, is actually increasing the amount of memory used by your web browser, rather than decreasing it. Furthermore, ABP also increases the amount of time (and CPU cycles) required to render a website. Instead of making web surfing more responsive, ABP actually makes your surfing experience slower.
This might seem counterintuitive at first — after all, ABP blocks all of those annoying animated Flash ads from loading, and so it should save you from unnecessary memory and CPU hits. Unfortunately, the actual situation is a lot more complex than that. Basically, ABP has grown too big for its own good, and just the very process of running ABP in your web browser consumes more memory and CPU cycles than it saves.
To begin with, according to Mozilla developer Nicholas Nethercote, there is a 60-70MB memory hit having Adblock Plus run in the background on Firefox. The main problem, though, is the process by which ABP actually blocks ads. Basically, ABP inserts a massive CSS stylesheet — occupying around 4MB of RAM — into every single webpage that you visit, stripping out the ads. This wouldn’t be a problem if we were still in the ’90s or early ’00s, but nowadays it is very common for a webpage to have lots of iframes, which are separate, individual webpages that are loaded and embedded within the page you’re currently looking at. The most common example is the ubiquitous social sharing widget (Facebook, Twitter, etc.) which is actually an iframe containing a separate webpage hosted on Facebook/Twitter’s servers.
You can probably see where this is going. On a modern website, there can be dozens of iframes. On the ExtremeTech homepage there are 10, which is pretty low. In Nethercote’s testing, he found that TechCrunch used around 194MB of RAM without ABP enabled — but that doubled to 417MB with ABP enabled, after triggering all of the social widgets. In an extreme example, the VIM Color Scheme Test website — which has hundreds of iframes — goes from a few hundred megabytes of memory to almost two gigabytes. Nethercote only tested ABP’s memory consumption in Firefox, but we performed the same test in Chrome and got the same results.
It’s harder to measure the CPU hit from having ABP enabled, but after some non-scientific testing it definitely feels like websites render more slowly with ABP installed. My CPU fan spins up more often when ABP is enabled, which is usually a good indicator that the CPU is being hit hard.
The irony, of course, is that ABP’s initial popularity stemmed from its ability to block noisy, annoying, and resource-hogging Flash ads. Now, because ABP’s block list is so large, it probably consumes more RAM and CPU cycles than it saves (though it will vary from site to site, of course).
Personally, I stopped using ABP long ago because free websites rely on advertising revenue — and I don’t want those free websites to go under. If you’re more worried about advertisers tracking you across the web, disabling third-party tracking cookies or using an add-on like NoScript is a much more effective (and efficient) route than using ABP. For annoying Flash ads, click-to-play add-ons like Flashblock (Firefox/Chrome) are a better option than ABP.
The other option, if you really want to block ads (especially those pesky pre-roll video ads on YouTube and the like), is to use some kind of ad-blocking proxy server. Privoxy is free, and if you run it locally there should be a minimal performance hit. As with all proxy servers, though, the one caveat is that it doesn’t work with HTTPS connections (which is a problem, because you really should be using HTTPS connections wherever possible, if you want to escape the ever-watchful eye of cyber crooks and the government).