Firefox 41 ships with massive memory improvements for Adblock Plus - gHacks Tech News

Firefox 41 ships with massive memory improvements for Adblock Plus

Version 41 of the Firefox web browser ships with memory improvements that benefit all users of the browser but Adblock Plus users especially.

When Mozilla ran memory tests against a set of popular Firefox add-ons recently it noticed that the popular extension Adblock Plus was adding an average of 60-70 Megabytes to the browser's memory usage.

It discovered furthermore that certain conditions could increase memory usage extremely so that the overall use of memory by Firefox would double, triple or even quadruple while sites remained open in the browser.

Tip: you can test this yourself by opening the following website in Firefox with Adblock Plus installed: http://vimcolorschemetest.googlecode.com/svn/html/index-c.html. You will notice that memory will go up dramatically while the page loads and while it remains open.

The patch that Mozilla added to Firefox 41, currently available in the Nightly channel, optimizes memory usage in the browser. When you compare memory usage of an optimized version of Firefox to one that does not include the patch, you will notice massive improvements.

firefox adblock plus memory usage

The screenshot above shows two instances of Firefox running on a PC with Windows 7 Pro 64-bit. Only the test web page was opened in the first and the result was a jump in memory to about 1.4 Gigabyte.

The test page did not increase memory nearly as much in the Nightly version of Firefox, especially since ten websites were already open prior to loading the test website in a new tab.

The reason for the increase in memory when visiting the test page in Firefox with Adblock Plus installed is that Firefox loads stylesheets multiple times even if they are identical when frames are being used on web pages.

Instead of sharing the stylesheet, it is creating copies of it for each frame on the page. The test page embeds lots of frames which explains the increase in memory usage as each frame adds about 3 Megabytes of memory to the browser's overall memory usage as Adblock Plus's stylesheet is about that size.

What the improvements that landed a couple of days ago help with is style sheets added at the user agent level (built in style sheets, such as those used for the default styling of HTML elements) or user level (which is where the userContent.css user style sheet is added, and where ABP adds its style sheet).

The memory optimization patch that landed in Firefox 41 enables the sharing of identical stylesheets. While that is been done mostly to improve the memory usage of Adblock Plus, all users of the browser benefit from the improvement even if they don't run Adblock Plus.

When a site uses frames for instance and references a stylesheet in a frame and on the main page, then it is loaded only once in memory instead of twice.

Tests showed small improvements in page loading time as well even though not nearly as impressive as the reduction in overall memory use.

Closing Words

The improvement benefits all users of the Firefox browser but especially Adblock Plus users. For Mozilla, it is not only about improving memory usage in Firefox but also bringing Firefox to levels of browsers it competes with. (via Sören Hentzschel)

Summary
Firefox 41 ships with massive memory improvements for Adblock Plus
Article Name
Firefox 41 ships with massive memory improvements for Adblock Plus
Description
Mozilla landed a patch in Firefox 41 that improves memory usage for all users of the browser but for Adblock Plus users in particular.
Author

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. michal said on June 30, 2015 at 12:05 pm
    Reply

    Interesting. Quick check using palemoon with gorhills ublock origin (and 4 other addons) gives 460 MB:)

  2. YB said on June 30, 2015 at 2:11 pm
    Reply

    650 megabytes is still quite a bit, despite the fact that many computers these days come equipped with 8 GB or more of Ram.

    Still the culprit seems to be Ad Block Plus. Time to either use a Secure DNS to block ads and malware or a host file. Or simply uninstall Ad Block Plus and use uBlock Origin

    1. Joker said on June 30, 2015 at 4:37 pm
      Reply

      “Still the culprit seems to be Ad Block Plus.”
      No. Have you actually read the bug-description?
      https://bugzilla.mozilla.org/show_bug.cgi?id=77999

    2. gh said on June 30, 2015 at 7:15 pm
      Reply

      Attempting to handle / block via HOSTS file is an “exercise in futility”. It’s analagous to the game “Whack-a-Mole” ~~ you keep adding and adding and adding and ADDING hostname entries, playing reactionary catch-up and never entirely keeping abreast of the newly-added hostnames.

      Case in point: Lookup “shallalist”, a categorized blocklist maintained and distributed by a (french, IIRC) university; intended for use in/on firewall appliances. Forty Million plus hostname entries last I checked (it’s updated approximately monthly), and it still doesn’t adequately cover the bases.

      Although I employ a dns proxy blocklist (which contains 475,000 _patterns_, not hostnames) I wouldn’t rely on it as a “first line of defense”. FWIW, the dns proxy/caching app I’m using (since around 2006?) is freeware “dnskong”. It accommodates use of patterns which can be as generic/greedy as, say, “teens”… such that a single line, a single entry will match/block countless hostname variations. (Nowadays, following the explosion of new TLDs, hostnames you’d probably never guess are bound to show up, like “teens.onmyface.gratis”)
      ref: http://newgtlds.icann.org/en/

      1. Skrell said on July 2, 2015 at 2:42 am
        Reply

        I’m VERY curious about this program dnskong! Can you please explain where you get the patterns and updates to those patterns so that it effectively blocks ads/trackers ? Also what do TLDs have to do with anything? PLEASE provide as much info as possible! :) Thank you!

      2. gh said on July 12, 2015 at 6:27 am
        Reply

        Skrell, all the breadcrumbs you need are in the earlier post. You wanna “get” lists? Have ’em handed to you? If so, for starters, do a websearch for “shallalist”.

        What do TLDs have to do with anything? Seriously?
        Suppose, for the sake of example, that you intend to block “yahoo”.
        With a HOSTS entry approach, your list would need to contain separate patterns for:
        yahoo.com
        http://www.yahoo.com
        yahoo.nl
        http://www.yahoo.nl
        yahoo.ca
        http://www.yahoo.ca
        ——- ad nauseum —— due to the availability of 500+ TLDs
        Does yahoo have domains listed across all possible TLDs?
        Idunno and don’t care to know. The point here is that your looooooong HOSTS list inevitably will be ineffective.

  3. jasray said on June 30, 2015 at 4:04 pm
    Reply

    Hmmm . . . Firemin returned to active development and takes care of memory issues.

    Pocket is still a mess, for me anyway. I must sign in every browser session?

    My oh my! The improvements Firefox developers make never ceases to amaze me.

  4. br0adband said on June 30, 2015 at 5:42 pm
    Reply

    I did some impromptu testing to verify this myself just now (using Firefox 38.0.6 vs today’s Nightly) but I wanted to see ABP vs uBlock so… this is what I ended up with after creating fresh clean portable installs of both versions of Firefox using the latest dev builds of each addon and then running them from a RAMdisk. The page load is that link listed in the article, of course.

    Firefox 38.0.6
    AdBlock Plus Dev 2.6.9.1 updated

    30 seconds = 230MB
    30 seconds after finished page load = 1.38GB

    Firefox 41 Nightly 06-30-2015
    AdBlock Plus Dev 2.6.9.1 updated

    30 seconds = 236MB
    30 seconds after finished page load = 263MB
    plugin-container = 320MB

    Firefox 38.0.6
    uBlock Origin v0.9.9.3 updated

    30 seconds = 181MB
    30 seconds after finished page load = 412MB

    Firefox 41 Nightly 06-30-2015
    uBlock Origin v0.9.9.3 updated

    30 seconds = 196MB
    30 seconds after finished page load = 368MB

    uBlock still ends up using less RAM in the long run than ABP does but it’s nice to see that seriously drastic reduction in memory consumption because of that patch on today’s Nightly v41 – that’s quite impressive.

    1. abcdef said on June 30, 2015 at 9:55 pm
      Reply

      You enabled e10 for Adblock Plus with Nightly and disabled it with the other blocker.

      You sould enable or disable e10 (plugin-container) for both.

      1. abcdef said on July 1, 2015 at 1:34 am
        Reply

        *should

  5. Andy said on June 30, 2015 at 5:55 pm
    Reply

    Martin,
    I can’t help but notice you’re using the 32-bit version of Firefox on 64-bit Windows. Have you tried 64-bit Firefox (either for Nightly or Developer channel)? I’d be interested in your take on how that affects memory usage.

    1. Martin Brinkmann said on June 30, 2015 at 6:04 pm
      Reply

      Andy, I have not tried it in a long while but plan to do so in the near future to find out about that.

  6. XenoSilvano said on June 30, 2015 at 9:03 pm
    Reply

    These improvement come too late for someone who has switched from Adblock Plus to uBlock.

    1. Daniela said on June 30, 2015 at 10:49 pm
      Reply

      just test it again. Lazy is not a reason to don’t have the best software option.

      1. Caspy7 said on July 1, 2015 at 10:39 pm
        Reply

        Someone already did. You can scroll up in the comments to see.
        uBlock still wins on memory usage as it lowers overall usage (by using less memory than the ads it blocks) while ABP still raises overall usage.
        (Referenced in this post from a Mozilla Developer: https://blog.mozilla.org/nnethercote/2015/07/01/firefox-41-will-use-less-memory-when-running-adblock-plus/ )

  7. jasray said on June 30, 2015 at 11:35 pm
    Reply

    I really don’t get it–not one other user using Rizone Firemin. So I am looking at 10-15 MB of memory with UBlock and no ABP; and 100 with UBlock and ABP. Why would I choose to not use a tool that is capable of reducing memory usage AND CPU usage so I can get along with doing what I am supposed to be doing on the Internet which isn’t checking memory consumption of one add-on. I think with 8GB of RAM or more, it really doesn’t matter in the Cosmic Mind what we do.

    Oh my . . . .

  8. Cameron McCormack said on July 1, 2015 at 5:12 am
    Reply

    Just to clarify, regular, document-level style sheets loaded via ‘style’ or ‘link’ elements in a page will not have their data shared across documents. That is a more difficult problem, but we plan to look at the feasibility of doing that. What the improvements that landed a couple of days ago help with is style sheets added at the user agent level (built in style sheets, such as those used for the default styling of HTML elements) or user level (which is where the userContent.css user style sheet is added, and where ABP adds its style sheet).

    1. Martin Brinkmann said on July 1, 2015 at 6:30 am
      Reply

      Cameron, thanks for the clarification. I have added part of it to the article to make things clearer.

  9. leland said on July 1, 2015 at 9:55 am
    Reply

    I found version 41 is now in the Developer version as of 6/30/15 and it also contains the improvments. It also fixes many bugs I saw in version 40 which made it unusable for me. All in all a nice update. And I don’t use ABP but Ad Muncher.

  10. '-' said on July 1, 2015 at 2:32 pm
    Reply

    It’s easier to just ditch Adblock Plus and use a decent ad blocker, like uBlock or Adguard.

  11. DonGateley said on July 5, 2015 at 7:19 am
    Reply

    I installed the Dev channel to get 41 to check the memory consumption (and multi-process) and I no longer have an Adblock Plus icon on my UI. It still shows in my list of installed extensions and appears to be active but no icon to turn it off or control it.

    Any ideas?

    1. abcdef said on July 5, 2015 at 7:18 pm
      Reply

      It was a bug that was fixed.

      Try Adblock Plus latest development build.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.