Mozilla

Firefox 7 is lean and fast

Based on a blog post originally posted here by Nicholas Nethercote, Firefox Developer.

tl;dr
Firefox 7 now uses much less memory than previous versions: often 20% to 30% less, and sometimes as much as 50% less. This means that Firefox and the websites you use will be snappier, more responsive, and suffer fewer pauses. It also means that Firefox is less likely to crash or abort due to running out of memory.

These benefits are most noticeable if you do any of the following:
- keep Firefox open for a long time;
- have many tabs open at once, particularly tabs with many images;
- view web pages with large amounts of text;
- use Firefox on Windows
- use Firefox at the same time as other programs that use lots of memory.

Background

Mozilla engineers started an effort called MemShrink, the aim of which is to improve Firefox’s speed and stability by reducing its memory usage. A great deal of progress has been made, and thanks to Firefox’s faster development cycle, each improvement made will make its way into a final release in only 12–18 weeks. The newest update to Firefox is the first general release to benefit from MemShrink’s successes, and the benefits are significant.

Quantifying the improvements
Measuring memory usage is difficult: there are no standard benchmarks, there are several different metrics you can use, and memory usage varies enormously depending on what the browser is doing. Someone who usually has only a handful of tabs open will have an entirely different experience from someone who usually has hundreds of tabs open. (This latter case is not uncommon, by the way, even though the idea of anyone having that many tabs open triggers astonishment and disbelief in many people. E.g. see the comment threads here and here.)

Endurance tests
Dave Hunt and others have been using the MozMill add-on to perform “endurance tests“, where they open and close large numbers of websites and track memory usage in great detail. Dave recently performed an endurance test comparison of development versions of Firefox, repeatedly opening and closing pages from 100 widely used websites in 30 tabs.

[The following numbers were run while the most current version of Firefox was in Beta and capture the average and peak “resident” memory usage for each browser version over five runs of the tests. “Resident” memory usage is the amount of physical RAM that is being used by Firefox, and is thus arguably the best measure of real machine resources being used.]

2
3

The measurements varied significantly between runs. If we do a pair-wise comparison of runs, we see the following relative reductions in memory usage:

Minimum resident: 1.1% — 23.5% (median 6.6%)
Maximum resident: -3.5% — 17.9% (median 9.6%)
Average resident: 4.4% — 27.3% (median 20.0%)

The following two graphs showing how memory usage varied over time during Run 1 for each version. Firefox 6′s graph is first, with the latest version second. (Note: Compare only to the purple “resident” lines; the meaning of the green “explicit” line changed between the versions and so the two green lines cannot be sensibly compared.)
Firefox 7 is clearly much better; its graph is both lower and has less variation.

ff6
ff7


MemBench

Gregor Wagner has a memory stress test called MemBench. It opens 150 websites in succession, one per tab, with a 1.5 second gap between each site. The sites are mostly drawn from Alexa’s Top sites list. I ran this test on 64-bit builds of Firefox 6 and 7 on my Ubuntu Linux machine, which has 16GB of RAM. Each time, I let the stress test complete and then opened about:memory to get measurements for the peak resident usage. Then I hit the “Minimize memory usage” button in about:memory several times until the numbers stabilized again, and then re-measured the resident usage. (Hitting this button is not something normal users do, but it’s useful for testing purposes because causes Firefox to immediately free up memory that would be eventually freed when garbage collection runs.)

For Firefox 6, the peak resident usage was 2,028 MB and the final resident usage was 669 MB. For Firefox 7, the peak usage was 1,851 MB (a 8.7% reduction) and the final usage was 321 MB (a 52.0% reduction). This latter number clearly shows that fragmentation is a much smaller problem in Firefox 7.
(On a related note, Gregor recently measured cutting-edge development versions of Firefox and Google Chrome on MemBench.)


Conclusion

Obviously, these tests are synthetic and do not match exactly how users actually use Firefox. (Improved benchmarking is one thing we’re working on as part of MemShrink, but we’ve got a long way to go. ) Nonetheless, the basic operations (opening and closing web pages in tabs) are the same, and we expect the improvements in real usage will mirror improvements in the tests.

This means that users should see Firefox 7 using less memory than earlier versions — often 20% to 30% less, and sometimes as much as 50% less — though the improvements will depend on the exact workload. Indeed, we have had lots of feedback from early users that the latest Firefox update feels faster, is more responsive, has fewer pauses, and is generally more pleasant to use than previous versions.

Mozilla’s MemShrink efforts are continuing. The endurance test results above show that the Beta version of Firefox already has even better memory usage, and I expect we’ll continue to make further improvements as time goes on.

40 comments

Comments are now closed.

  1. Duke S. wrote on September 27th, 2011 at 12:09:

    Thank you, thank you, thank you … I was getting ready to dump my favorite browser because it was bleeding memory to the point that it had to be closed and reopened more than once a day! Greatly appreciate this fix!

  2. Joe Katzman wrote on September 27th, 2011 at 12:16:

    Just wanted to say thank you so much for this effort. It really hits a serious performance problem for many web browser customers like myself.

    Even if we don’t have hundreds of tabs open right now, the browser is our window on the world. Many of us will keep our browsers open for over a week (thank you, improved desktop OS stability!). Add up the number of sites visited over that time, and it definitely grows.

    When I quit a web browser, it’s almost always a response to computer performance issues, not because I want to quit it at that time. I’d really love to stop doing that – and the about:memory trick is a good one.

    It will get even better when I no longer have to use it, because Mozilla is handling that itself. It’s fun to fly the plane yourself, but let’s face it. Most of us just want to sit down and get to Hawaii, y’know?

  3. Sean wrote on September 27th, 2011 at 13:23:

    Been looking forward to this release for a while. I leave Firefox open for days on end typically and memory could easily hit 1GB after that amount of time, which is when I would typically restart it. Nice work team!

    1. Sean wrote on September 27th, 2011 at 13:26:

      I made an anonymous comment and the form refilled with someone else’s name and email address – my address isn’t “s…..y@gmail.com” but I think Sean’s is. Might want to fix this.

  4. Joe Montibello wrote on September 27th, 2011 at 13:24:

    I was starting to consider alternatives to firefox because of the memory issues. But you fixed it! Thanks.

  5. Daniele wrote on September 27th, 2011 at 14:01:

    I know that is not scientific and that can be mean nothing, but with firefox 4 and firefox 5, memory taken by firefox on my Lion is about 600Mb, same thing with firefox 7, i can’t see any improvement. On windows i have completely solved the problem with memory fox (a firefox extension) that (for me) lowered memory from 300-400Mb to 50-100

    1. Sante wrote on September 29th, 2011 at 14:36:

      The extension you mentioned does not makes firefox use less memory, it only hide memory consumption to Windows task manger. For testing this you have to look at your free memory and you’ll that with or without memory fox you will have the same free memory on your system.

  6. Till wrote on September 27th, 2011 at 15:39:

    Just a quick note. http://firefox7.org/ links to http://hacks.mozilla.org/2011/09/firefox-is-lean-and-fast/ but this actual URL is http://hacks.mozilla.org/2011/09/firefox-7-is-lean-and-fast/

  7. gary wrote on September 27th, 2011 at 22:41:

    thanks

  8. Jack_India wrote on September 28th, 2011 at 01:14:

    First i want to say you a big “Thank You” for addressing the major problem that every mozilla user frustrated about frequently.

    I think i may get the guiness record for crashing Mozilla a 5000 times within 5 months.

    All crashes are happening when using more than 50 or above 100 tabs.
    I have 2gb ram and firefox usually crashes automatically when memory usage tops to 850 MB – 1GB.

    I lose every patience when firefox crashes in the middle of surfing e-mail or any other important topic.

    And rest i could only see is a Mozilla Crash Reporter window.
    But clicking Submit Report was always been a failure, when it always says “Firefox cant submit report because of some problems”.

    Anyway would like to see many improvements only in Memory management of firefox, because people only want stability from a browser to browse infinitely.

    —>Thanks a million lot for the memory optimization…

  9. Adam wrote on September 28th, 2011 at 06:34:

    Wow, the difference is noticeable! I’ve been using chrome because firefox was taking too much memory before ( I have only a 512mb card). It seems firefox is doing a better job now. Chrome seems to spent much of the time swapping to disk, and it can get reeallly slow..

  10. Carl114 wrote on September 28th, 2011 at 08:20:

    Thank you! I often open many articles and pages (i am bloger). Sometimes more than 30th I hope the update helps. Memory usage was really bad.

  11. Bward wrote on September 28th, 2011 at 13:38:

    This is great, firefox has been using over one gig of memory for quite a while now on my system. it is currently only using 485 Meg. I had been really frustrated with it.

  12. Rational Db8 wrote on September 29th, 2011 at 02:19:

    Plenty of us are still using 3.6 for various reasons, including not trusting new releases to not be buggy. I tried 5 briefly, and went back to 3.6. The memory improvements are great and sorely needed – BUT, how does it compare to 3.6?? You folks want us to upgrade, then show us how it compares to what we are currently using.

    1. RAM wrote on October 27th, 2011 at 14:18:

      I agree

  13. Ttoviyah wrote on September 29th, 2011 at 06:24:

    It’s great to hear about this update, and I certainly hope these memory issues will continue to be improved. My MacBook with 2 gigs of memory was working hard, and I had just switched in the last week to using other browsers. I’m excited to be back on the Mozilla bandwagon.

  14. Nigel Smith wrote on September 29th, 2011 at 07:43:

    Thank you! This is a big improvement over the earlier versions.

  15. Thomas Svenson wrote on September 29th, 2011 at 07:47:

    Without a doubt you have scored amazing results with the shrinking of usage of physical RAM. I haven’t had one “Not responding” situation since upgrading to FF7. It is much snappier and I don’t have to restart it every hour.

    However, while valuable RAM is freed up it still keeps growing Commit Size continuously. Right now it is over 3GB for me and the browser is noticeable slower. If that can be fixed as well, its very possible I could uninstall the the “Restart Firefox” extension since I would hardly need to use it based on how good the improvements to RAM is.

  16. Jabbawest wrote on September 29th, 2011 at 10:23:

    This headline looks familiar. Oh right, something like this was said for 5 too but it was a memory and resource pig.
    I know it’s free but 3 was a far less resource hog than five. Doesn’t beta testing feedback tell you these thing? I know I reported this issue with 5 yet it was still rolled out with the same boastful headline.
    I’ve suffered long enough, please get it right this time.

    Thank you

  17. Jim wrote on September 30th, 2011 at 10:20:

    Memory usage still seems to be climbing on my system for no really apparent usage (with FF7.0 and FF7.0.1 today).

    I start Firefox with a blank page – and it’s using about 115-150 MB memory.
    Then I viewed the release notes for the 7.0.1 and then this hacks page to read what others were commenting. All this with only the one tab, and Firefox is now using 291 MB and still climbing. The app’s only been open for maybe 5-10 minutes.

    I’ve seen the same type of memory climb happen also with all extensions disabled so it does not appear to be extension related – and I have verified that all the active plugins are up to date. Beyond that, I don’t know what can be done to stop the slow climb (it’s now up to 299.9 MB as I type this last bit of my comment here)

    1. Jim wrote on September 30th, 2011 at 10:22:

      I should have mentioned my system specs:
      - Firefox 7.0.1
      - Mac OS X (10.6.8)
      - 4 GB Memory

  18. Kenneth wrote on October 1st, 2011 at 04:14:

    Thank you so much that this thing has been fixed… I thought I would never use my old time favorite browser because I temporarily use another one for the issue of the memory usage.. Now its great to be back again

  19. riqkla wrote on October 2nd, 2011 at 07:05:

    Excelente!!

  20. Mark the Personalised wine Guy wrote on October 2nd, 2011 at 09:44:

    Definitely an improvement.

  21. Rahly wrote on October 2nd, 2011 at 17:38:

    I dont know what you people are doing, but i’ve left pre3.x open for almost half of a year, with 6-7 tabs open consistantly, and it was maxed out at 200 megs. The only time i’ve ever seen massive memory usage was when you have something like firebug installed, because it makes like 20-30 copies of the entire DOM in memory. Trust me, remove the crappy memory using plugins and there will be no problems.

  22. Transcontinental wrote on October 4th, 2011 at 06:36:

    The big turn started with Firefox 4, and Route 66 truly appeared with Firefox 7. I notice it every day, much faster start (cold & warm) and pages’ rendering velocity. Everything here is fast and smooth (and yet I have 60+ extensions on a 1.6gH machine!). A great achievement and, as they say, a work (always) in progress. Gee, when I see all that has been done, improved since Firefox 2.* (that’s when I adopted Firefox as default browser) I remain stunned! What a fantastic browser :)

  23. thaddeusmt wrote on October 6th, 2011 at 10:12:

    This “MemShrink” project is good news, and overdue. I have almost completely stopped using Firefox due to it hogging 1-2GB of memory after a day of use (that, and my favorite extensions failing to keep up with these rapid releases…). Let’s see what 7 can really do!

  24. Norman wrote on October 8th, 2011 at 15:02:

    Thanks for sharing the details of the memory improvement. Been running all the heavy apps on chrome for the last few months just to avoid having to restart firefox a few times in a night. I now have the confidence to go back and trial using FF7 again. Hope things are truely improved. fingers cross.

  25. Super Slave wrote on October 9th, 2011 at 19:03:

    Firefox has definitely gotten faster & more streamlined.
    The features added & bugs fixed are appreciated as well.

    What is not appreciated, is the fact that Firefox seems to creep upwards in mem usage, particularly in using youtube, etc.

    Why doesn’t firefox just let go of a website as you navigate to a new one in the same tab? Release the memory? Only remember the page address, & not the entire video still in cache?

    I love firefox, but sometime it eats up my mem, & this is on the latest 7 of it.

    Thanks!

  26. Erik wrote on October 10th, 2011 at 12:12:

    I’m sorry.. but every single previous version of FF was running perfectly on my laptop, which was why I started usin FF in the first place.
    Since this latest update I’ve been at the point of throwing the d*mn thing out of my window, since it freezes up as soon as I open whatever page. When I need to fill in a form or a login or whatever, it’s just unresponsive for several seconds. This problem appeared on the latest FF update, and it stayed after the 7.01 update.

    It was one of the major reasons for switching from IE to FF, since IE 8.0 had the same problem, and after 1,5 year of using FF without a problem, I’m now at the point of trying out something else.. No idea what though.. :(
    My laptop: Toshiba Sat. A300D-14R 4GB, AMD x2 2.1 Ghz.

    If somebody has a solution, please tell me..

    1. Janet Swisher wrote on October 10th, 2011 at 12:29:

      Sorry to hear you’re having problems. This support thread might be relevant: https://support.mozilla.com/en-US/questions/882138

      If not, you could always post your own question on the support site. That’s more likely to get you help than commenting on a developer-oriented blog.

  27. jacquline kleiss wrote on October 13th, 2011 at 10:00:

    my tech said by closing a toolbar that it still interfers with the speed of the browser is there a way of closing it and it will make browser faster. i am not to much on tech being 61 just know what i like..smile

  28. Pete wrote on October 25th, 2011 at 02:05:

    Firefox 7 has not solved the problem at all. On my older laptop with Windows XP and 1 gig of RAM it still climbs up because I always have 8-12 windows opened. If left opened the memory still creeps up badly. I constantly have to use the Windows Task manager and close the browser and restore to get it back down to manageable levels 2-3 times a day. It;s a pain. Firefox 7 sucks. I never had this problem with Firefox 3. I’m sorry I upgraded to 5 and now to 7. Pathetic! Is there any solution as I prefer Firefox as a browser.

  29. Pete wrote on October 27th, 2011 at 19:43:

    Firefox 7 is worse than ever on a older laptop with XP and one gig of RAM. I’ll go out for a few hours and leave like 7-10 windows open and it sucks up all my memory. I’m tired having to close the browser and then restoring over and over. Pure garbage. No one has any fixes? I still prefer Firefox as a browser. Or is is better to remove Firefox 7 and install an older version of Firefox 3?

  30. angie wrote on October 31st, 2011 at 20:21:

    I just installed FIrefox 7. I had to shut it down because it was using 1GB of ram and was making my system unstable. (I have 2GB Ram, Intel dual core 2.93 processor and a 3mb L2 cash. Restarted it and now it’s using 237mb ram and climbing. I’ll see if I’m gonna keep this.

  31. David wrote on November 1st, 2011 at 18:08:

    Firefox 7 is no better than previous versions, I leave it open for as long as I can, it starts up automatically at about 4-500MB memory, then continues to increase to over 1GB if I leave it for a few hours. Maybe it’s my extensions, or maybe it’s the pages I visit/leave open, but it’s ridiculous, chrome doesn’t seem to have these memory issues.

  32. vlad wrote on November 6th, 2011 at 12:46:

    it’s getting worse and worse and naming it 7 won’t help too much.
    A huggie monkey and spreat the love won’t help me when i have to restart FF7 every hour .

    The Linux kernel version is at version 3 after 20 (twenty) years.
    Maybe you should get a lesson in humility from Linus :

    So what are the big changes?

    NOTHING. Absolutely nothing. Sure, we have the usual two thirds driver
    changes, and a lot of random fixes, but the point is that 3.0 is
    *just* about renumbering, we are very much *not* doing a KDE-4 or a
    Gnome-3 here. No breakage, no special scary new features, nothing at
    all like that. We’ve been doing time-based releases for many years
    now, this is in no way about features. If you want an excuse for the
    renumbering, you really should look at the time-based one (“20 years”)
    instead.

    So no ABI changes, no API changes, no magical new features – just
    steady plodding progress. In addition to the driver changes (and the
    bulk really is driver updates), we’ve had some nice VFS cleanups,
    various VM fixes, some nice initial ARM consolidation (yay!) and in
    general this is supposed to be a fairly normal release cycle. The
    merge window was a few days shorter than usual, but if that ends up
    meaning a smaller release and a nice stable 3.0 release, that is all
    good. There’s absolutely no reason to aim for the traditional “.0″
    problems that so many projects have.

  33. Burner wrote on December 15th, 2011 at 22:23:

    Firefox has gone down over the years. I have now moved onto chome

  34. BJE wrote on January 21st, 2012 at 20:36:

    FF 9.0.1

    On openSuSE 12.1

    Machine has Phenom X6, 16 GB RAM – FF 9.0.1 hangs – DOA, no response, nada

    Other machine has openSuSE 11.3, Intel P4 2.4 GHz, 2.0 GB RAM, FF 4.0 – slow to respond, but does not freeze – loads same tabs as above

    Do we see a problem here? Overwhelming machine freezes on FF 9.0.1

    Sub-par box chugs away… with lots of extensions… just slow….

    Mozilla recommendation when this happens? : “Firefox may hang if left open for long periods of time. To fix the issue, restart Firefox. ”

    Long periods of time on the 6-core machine – 2 hours

    Long periods of time on the single core P4 machine – 5+ months

    Um, what kind of resolution is this?

    Have you been sucking coffee in Redmond too long?

    Seriously? To resolve the problem, close the app and restart?

    Again – really??? that’s the solution? Restart FF?

    REALLY? That’s the solution????

  35. AC wrote on March 3rd, 2012 at 13:00:

    I’ve used Firefox sinc efirst release, it is still my fav web browser but needs to takes lessons from opera, it needs rewriting from scratch most likely, something the devs of FF are not willing to admit, unlike Linus with Linux, he admits they are bloated. FF is way too bloated. When using v3.5-v3.6 RAM use is just about acceptable and stable, back when that was released I only had 1GB DDR RAM and thought at the time it was unstable because it did used to crash or hang and not respond, but now I have 2GB DDR2 RAM it seems acceptable. My new system has 16GB DDR RAM which is going to be used up by my software that I use, contrary to what most claim about such amount of RAM not being used, programmers are light years behind hardware manufacturers so they still do not know how to make efficient software, too hard work for them, when I first started computing at home back in 1997 several IT people told me that software engineers were lagging 30 year sbehind hardware tech, think what is must be now, probably 190 years…

    Still, I love FF. It kinda sucks though that it uses 600MB RAM as minimum when no websites are even open! I use Memory Fox which helps with the RAM leaks, and no the memory issues with FF have yet still to be fixed! I get the same experience when using addons or not, tried everything ad ruled out other addons or software on my system, often I try vanilla installs of windowswith addition of clean FF install and profile, still no improvement. Gues sI will need 128GB DDR4 RAM in 3-6 years time.

Comments are closed for this article.