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: d76938ff6b856cdf458892d1937adb90

<span id="intelliTXT" name="intellitxt"><img src="http://www.extremetech.com/wp-content/uploads/2014/05/sad-firefox-abp-logo-640x353.jpg" class="attachment-full wp-post-image" alt="Sad Firefox, with an ABP logo on its face"/><p>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.</p><p>This might seem counterintuitive at first — after all, ABP blocks all of those annoying animated Flash ads from loading, and so it <em>should</em> 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.</p><div id="attachment_182453" class="wp-caption alignnone"><a href="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-plus-how-it-works.jpg"><img class="size-large wp-image-182453" alt="How Adblock Plus works" src="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-plus-how-it-works-640x298.jpg"/></a><p class="wp-caption-text">How Adblock Plus works</p></div><p>To begin with, <a href="https://blog.mozilla.org/nnethercote/2014/05/14/adblock-pluss-effect-on-firefoxs-memory-usage/">according to</a> 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 <em>iframes</em>, 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 <a href="http://www.w3schools.com/tags/tag_iframe.asp">iframe</a> containing a separate webpage hosted on Facebook/Twitter’s servers.</p><p>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 <a href="http://vimcolorschemetest.googlecode.com/svn/html/index-c.html">VIM Color Scheme Test website</a> — 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.</p><div id="attachment_182433" class="wp-caption alignnone"><a href="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-pro-chrome-memory-usage-disabled.jpg"><img class="size-large wp-image-182433" alt="Chrome memory usage, lots of iframes, AdBlock Pro disabled" src="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-pro-chrome-memory-usage-disabled-640x409.jpg"/></a><p class="wp-caption-text">Chrome memory usage, lots of iframes, Adblock Pro disabled</p></div><div id="attachment_182434" class="wp-caption alignnone"><a href="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-pro-chrome-memory-usage-enabled.jpg"><img class="size-large wp-image-182434" alt="Chrome memory usage, lots of iframes, AdBlock Pro enabled" src="http://www.extremetech.com/wp-content/uploads/2014/05/adblock-pro-chrome-memory-usage-enabled-640x409.jpg"/></a><p class="wp-caption-text">Chrome memory usage, lots of iframes, Adblock Pro enabled</p></div><p>It’s harder to measure the CPU hit from having ABP enabled, but after some non-scientific testing it definitely <em>feels</em> 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.</p><p>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).</p><div id="attachment_117639" class="wp-caption alignright"><a href="http://www.extremetech.com/wp-content/uploads/2012/02/red-panda-firefox-taking-a-break.jpg"><img class="size-medium wp-image-117639" alt="A sad and tired red panda (firefox)" src="http://www.extremetech.com/wp-content/uploads/2012/02/red-panda-firefox-taking-a-break-300x225.jpg"/></a><p class="wp-caption-text">A sad Firefox, in real life (a red panda)</p></div><p>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, <a href="http://www.extremetech.com/internet/180485-the-ultimate-guide-to-staying-anonymous-and-protecting-your-privacy-online">disabling third-party tracking cookies or using an add-on like NoScript</a> is a much more effective (and efficient) route than using ABP. For annoying Flash ads, click-to-play add-ons like Flashblock (<a href="https://addons.mozilla.org/en-US/firefox/addon/flashblock/">Firefox</a>/<a href="https://chrome.google.com/webstore/detail/flashblock/gofhjkjmkpinhpoiabjplobcaignabnl?hl=en">Chrome</a>) are a better option than ABP.</p><p>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. <a href="http://www.privoxy.org/">Privoxy</a> 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).</p></span>