Firefox 24/26 ships with serious memory consumption improvements on image-heavy pages

Martin Brinkmann
Oct 1, 2013
Updated • Oct 1, 2013
Firefox
|
14

Here is a test. Open your Task Manager on your system and then this image-heavy page in the Firefox web browser. Is the memory count going up like crazy on that page and staying there? Then you are running Firefox 23 or older on your system.

Now open that very same page in Firefox 24, and then in Firefox 26. You will notice that the page is not nearly making a dent in Firefox 26 thanks to memory consumption improvements that Mozilla implemented in this version of the browser. In Firefox 24, you will notice that the consumption drops after the first peak.

First improvements landed in Firefox 24, but the real deal ships with Firefox 26. On my test system, I opened the page in Firefox 26 and Firefox 23, and compared the memory consumption after the page had been loaded.

Note that I had about 20 tabs open in Firefox 26, and only one in Firefox 23.

Firefox image-heavy page optimizations

firefox image optimization

  • Firefox 23: 1809956 K
  • Firefox 26: 372592 K

So why the huge difference in memory consumption?

Firefox 23 and older versions of the browser decode every image found on the page and retain the data for as long as the page is in the foreground.

The memory fix introduced in Firefox 24 keeps only the visible images in memory. While it will still decode all images on the page, you will notice that memory consumption drops shortly thereafter due to this.

The Firefox 26 improvement takes care of the initial burst in memory usage. Instead of decoding all images on the page, it only takes care of the visible images so that only those are decoded on page load. This not only means that the memory consumption stays low and won't peak on page load, but also that the page loading times of image heavy pages are improved significantly.

Since Firefox does not have to decode all images on page load, the page itself loads a lot quicker in the browser.

firefox memory optimization

According to Mozilla, these improvements do not affect the scrolling performance of Firefox. While it is too early to say if this is really the case, it is likely that most users won't notice a difference in scrolling behavior on image-heavy pages.

The feature introduced in Firefox 24 and 26 is similar to a technology called lazy loading which is used by webmasters to speed up the loading of their sites. Instead of loading all images on user connection, those visible are loaded with priority, with the remaining ones only loaded when they are needed (in this case when the user scrolls down so that they become visible on the page).

Other browsers

Wonder how other browsers are handling that page? Google Chrome's memory consumption does not increase by a lot when the page is loaded. You will see a peak in memory and some cpu utilization though during the decoding, but the process responsible for the page stays well within memory limits (jumps to about 200K)

The new Opera browser handles the page exactly as Chrome does.

Microsoft's Internet Explorer 11 has no issues loading the page, and memory consumption won't jump by much (to about 160K.

Closing Words

If you hang out on image-heavy pages, web forums for instance, a lot, you will certainly benefit from the improvements made. That's great for users who use machines with little RAM, but should also have an impact on other users of the browser.

With all other browsers handling memory consumption in a better fashion on image-heavy pages, it was time that Mozilla reacted and modified how Firefox handles those pages. The engineers responsible did a fantastic job and eliminated the issue in Firefox.

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Richard Steven Hack said on October 2, 2013 at 9:15 pm
    Reply

    Hopefully changing the way they handle image memory will improve its behavior in Google Image Search and image download sites. I frequently have Firefox crash the Plasma Desktop in openSUSE 12.3 Linux when on Google Image Search.

    It HAS improved from previous releases. In earlier Firefox releases on openSUSE 12.2, it would slow down enormously and eventually I would have to restart Firefox or even reboot as it began hitting 100% CPU.

  2. FX said on October 1, 2013 at 6:54 pm
    Reply

    https://bugzilla.mozilla.org/show_bug.cgi?id=841734

    Firefox 27.0 has more memory efficiency improvements for PNG images thanks to the update to libpng 1.6.6. Firefox is the most memory efficient browser and blows Chrome garbage out of the water in performance and efficiency.

  3. RG said on October 1, 2013 at 5:57 pm
    Reply

    @commenters above, Look at the graph. 24 is an improvement but 26 is a huge improvement. Not that I can confirm but still, the article does say 24/26 but 26 should be the focus based on the graph.

  4. andyjm said on October 1, 2013 at 3:15 pm
    Reply

    I get mostly similar results to you on the image heavy page Martin, with one very strange exception.
    I’m using Windows 8, Internet Explorer 10, Firefox 24 and Chrome 29.
    Windows task manager says IE10 uses about 250mb with that page. Chrome’s built in task manager reports IE10 as using 3gb for the same page. Given that my total RAM usage drops by 3gb when I close IE10 I think Chrome’s numbers might be right!
    It’s slightly off topic I know, but it would be interesting to know if you get the same with IE11.

    To get back on topic, I’m looking forward to Firefox 26.

    1. toto said on October 2, 2013 at 4:00 am
      Reply

      3gb seriously!!!!

    2. Martin Brinkmann said on October 1, 2013 at 3:23 pm
      Reply

      I just checked, and can confirm that. The Windows Task Manager and Chrome are reporting different RAM uses. I checked with Process Explorer, and it confirms Chrome’s reading. Not sure though why the values are not reported in the Task Manager correctly.

      http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

      1. andyjm said on October 1, 2013 at 3:37 pm
        Reply

        I now know not to rely on Windows task manager in the future.

        Thanks for confirming it and reminding me about Process Explorer.

  5. slink said on October 1, 2013 at 12:25 pm
    Reply

    er, just upgraded to 24, tried the image page, memory for firefox.exe went to over 2GB and then I got the Mozilla crash report window. Lol

    1. John said on October 1, 2013 at 2:17 pm
      Reply

      We are talking about 26 here.

      1. BobbyPhoenix said on October 1, 2013 at 2:58 pm
        Reply

        Then the article is wrong?

        “Firefox 24/26 ships with serious memory consumption improvements on image-heavy pages”.

  6. Marc said on October 1, 2013 at 12:03 pm
    Reply

    Ubuntu FF24, spiked from my 500mb to 1400mb for a few instances, then dropped down to 600.
    This is fantastic!

  7. pd said on October 1, 2013 at 11:24 am
    Reply

    I proved this in Aurora today. Absolutely sensational effort/news. Congratulations to Timothy Nikkel. Seriously heroic coder!

  8. EuroSceptiC.GRE said on October 1, 2013 at 10:45 am
    Reply

    Firefox is so bloated and inefficient that only starting from scratch could save it.

    In terms of design… 3 different highlighting methods and one custom-made, is more than enough to tell how disorganized it is.

    Can’t wait for Opera to get the basic stuff and stable in order to move completely.

    1. John said on October 1, 2013 at 2:26 pm
      Reply

      “Firefox is so bloated and inefficient that only starting from scratch could save it.”

      An interesting link: http://www.joelonsoftware.com/articles/fog0000000069.html

      “In terms of design… 3 different highlighting methods and one custom-made, is more than enough to tell how disorganized it is.”

      I don’t know what you are talking about, but it sounds quite simple. Do you really generally judge a browser from a simple thing like this?

      In general, your post sounds like you don’t know what you are really criticising.

Leave a Reply

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

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.