Mozilla launched Firefox 41 yesterday. Today, Adblock Plus confirmed the update “massively improves” the memory usage of its Firefox add-on.
Adblock Plus is Firefox’s most popular add-on. According to Mozilla’s add-ons site, it has over 20 million users.
This particular memory issue was brought up in May 2014 by Mozilla and by Adblock Plus. But one of the bugs that contributed to the problem was actually first reported on Bugzilla in April 2001 (bug 77999).
Mozilla developer Cameron McCormack recently fixed bug 77999, enabling sharing of CSS-related data. Data structures that share the results of cascading user agent style sheets are now a go, which allowed the second issue (bug 988266) to be fixed as well.
AI Weekly
The must-read newsletter for AI and Big Data industry written by Khari Johnson, Kyle Wiggers, and Seth Colaner.
Included with VentureBeat Insider and VentureBeat VIP memberships.
In short, Adblock Plus was registering a single style sheet for its element-hiding feature, but Firefox was creating a new copy of it for each page being loaded. This meant that the memory consumption could skyrocket (up to 2GB in one edge case) as more copies were created.
Mozilla developer Nicholas Nethercote shared some numbers in July when a Firefox Nightly build was released with the fixes:
For example, on the above-mentioned “extreme example” (a.k.a. the Vim Color Scheme Test) memory usage dropped by 3.62 MiB per document. There are 429 documents on that page, which is a total reduction of about 1,550 MiB, reducing memory usage for that page down to about 450 MiB, which is not that much more than when AdBlock Plus is absent. (All these measurements are on a 64-bit build.)
I also did measurements on various other sites and confirmed the consistent saving of ~3.6 MiB per document when AdBlock Plus is enabled. The number of documents varies widely from page to page, so the exact effect depends greatly on workload. For example, for one of my measurements I tried opening the front page and four articles from each of nytimes.com, cnn.com and bbc.co.uk, for a total of 15 tabs. With Cameron’s patches applied Firefox with AdBlock Plus used about 90 MiB less physical memory, which is a reduction of over 10%.
Even when AdBlock Plus is not enabled this change has a moderate benefit. For example, in the Vim Color Scheme Test the memory usage for each document dropped by 0.09 MiB, reducing memory usage by about 40 MiB.
Your mileage will of course vary depending on your computer and the sites you visit. These improvements have been trickling down since July’s Nightly build, first to Firefox Developer Edition, then to Firefox Beta, and now to the latest stable version. This is a huge win for both Mozilla and Adblock Plus, as Firefox now uses “about the same amount of memory” whether you’re running the most popular add-on or not.
Many Firefox users will gladly use more memory to block ads, but now they don’t have to use nearly anywhere as much.
VentureBeat's mission is to be a digital town square for technical decision-makers to gain knowledge about transformative enterprise technology and transact. Learn More