Getting snappy – performance optimizations in Firefox 13

Back in the fall of 2011, we took a targeted look at Firefox responsiveness issues. We identified a number of short term projects that together could achieve significant responsiveness improvements in day-to-day Firefox usage. Project Snappy kicked off at the end of the year with the goal of improving Firefox responsiveness.

Although Snappy first contributed fixes to Firefox 11, Snappy’s most noticeable contributions to date are landing with Firefox 13. Currently in beta, this release includes a number of responsiveness related fixes, most notably tabs-on-demand, cycle collector improvements, and start-up optimization.

Tabs -on-Demand

Tabs-on-demand is a feature that reduces start-up time for Firefox windows with many tabs. In Firefox 12, all tabs are loaded on start-up. For windows with many tabs this may cause a delay before you can interact with Firefox as each tab must load its content. In Firefox 13, only the active tab will load. Loading of background tabs is deferred until a tab is selected. This results in Firefox starting faster as tabs-on-demand reduces processing requirements, network usage, and memory consumption.

Cycle Collector

As you interact with the browser and Web content, memory is allocated as needed. The Firefox cycle collector works to automatically free some of this memory when it is no longer needed. This action reduces Firefox’s memory usage. In Firefox 13, the cycle collector is more efficient, spending less time examining memory that is still in use, which results in less pauses as you use Firefox.

Start-up

Firefox start-up time is visible to all users. Our investigation into start-up has identified a number of unoptimized routines in the code that executes before what we call “first paint”. “First paint” signifies when the Firefox user interface is first visible on your screen. In Firefox 13 we have optimized file calls, audio sessions, drag and drop, and overall IO, just to name a few. We are continuing to profile the Firefox start-up sequence to identify further optimizations that can be made in future releases.

There are numerous other Snappy fixes in Firefox 13 including significant improvements to IO contention, font enumeration, and livemark overhead. All of these fixes contribute to a more responsive experience. We are already working on further responsiveness fixes for future Firefox releases. You can expect to see Snappy improvements in upcoming releases in areas such as memory usage, shutdown time, network cache and connections, menus, and graphics.

About Lawrence Mandel

Firefox Engineering Program Manager

More articles by Lawrence Mandel…


61 comments

  1. Andy

    Chrome appears to cheat when it starts up, you get a near-instant interface painted but you can’t do all that much with it, if you type a URL in there’s no history and it can take a few seconds more than usual to actually go to that URL.

    Despite knowing this and rationally thinking about it the time from startup to ‘getting to google.com’ isn’t all that different from firefox I find I prefer this.

    Any plans for FF to do this?

    May 11th, 2012 at 03:49

    1. Abhay Rana

      Yes, I find it pretty good as a UX design choice. Although, it does not respond as expected during those 5-6 seconds, but it always feels good knowing that chrome has started up.

      May 11th, 2012 at 07:06

  2. Alec

    I hate to say this, but you’re incredibly late to the party on this. You’re only now taking a serious look at performance issues which have been causing your users to leave in droves for years to faster alternatives?

    Better late than never I guess. At least you have support for “text-size-adjust”!

    May 11th, 2012 at 04:51

    1. Hans

      @alec, I think your comment is late to the party. Chrome is still trying to figure this one out. and interestingly enough they are looking at Firefox solution as an example to follow.
      http://code.google.com/p/chromium/issues/detail?id=105666

      BTW: It is already there in FF – – you need to opt in on the General tab.

      May 28th, 2012 at 10:38

  3. smaug

    The most important cycle collection optimization (black-bit-propagation during forget-skippable phases) is already in FF12. FF13 and later have some more fixes to keep cycle collection times low.

    May 11th, 2012 at 06:35

  4. pd

    Unfortunately tabs-on-demand is a misnomer. What it should really say is delayed-tab-loading. I wish Mozilla wouldn’t spin their choices. I would prefer a Mozilla that is more Dogbert than the Pointy Haired Boss.

    The “Start-up” changes sound like legitimate changes which will add to the previous work such a streamlining file IO through methods such as putting a lot of files into omni.ja Whereas the delayed-tab-loading sounds like a performance hit for users rather than a performance gain. It’s just trading faster first-paint for slower loading of secondary and subsequent tabs.

    If delayed-tab-loading is going to be a long-run strategy isn’t it actually going to completely reverse the biggest benefits of tabbed browsing? Personally I open tabs by flick-dragging them into new background tabs as I read through articles. That way when I’m finished reading, I can move on to already-loaded pages waiting for me rather than me having to wait for them.

    I can understand the choice and need to make immediate short-term performance gains to compete with other browsers but let’s not pretend that delayed-tab-loading is anything more than a short-term attempt to boost performance whilst the longer-term real solution is to fix the nitty gritty like IO contention and the other changes you listed.

    May 11th, 2012 at 07:54

    1. Lawrence Mandel

      Tabs-on-demand is only active for background tabs on start-up. The scenario you outlined, flick-dragging tabs to background tabs for later reading, will continue to function as it currently does. The new tab will be created and content will be loaded.

      May 11th, 2012 at 08:43

    2. Mysterious Andy

      @pd: Are you aware that the tone of your comments tends to be “Assume nefarious intent; accuse and decry!”?

      May 15th, 2012 at 09:29

  5. Steve Price

    What about App Tabs? I’m using Aurora on Vista and Ubuntu. While Ubuntu is snappier (no surprise there) all my app tabs still seem to be competing to load at startup. In Vista, especially during the post-boot drive churn, the startup time is downright painful. Are App Tabs on Demand on the agenda? Love the blog, I’m a daily reader!

    May 11th, 2012 at 08:15

    1. kwierso

      App tabs are considered things you always want loaded, so they’re always resumed on startup.

      There IS a hidden preference in about:config to stop this. Don’t have the preference name handy, but you should be able to find it by filtering on “tab”.

      May 11th, 2012 at 18:38

  6. Mike B

    I have been using the beta and find the delayed loading during start is a good thing, but it gets extremely annoying during regular browsing sessions as it eliminates most of the benefits of opening a background tab. IMO, this should only use the behavior during browser start, but should load background tabs as normal in regular browsing sessions.

    I understand the intent, but it breaks current usage efficiencies. please consider implementing only for browser startup.

    May 11th, 2012 at 08:32

    1. Mike B

      I should also note that even on browser startup, once the current tab is done, the background tabs should load, or it should be an option.t

      May 11th, 2012 at 08:38

    2. Lawrence Mandel

      In my daily browsing background tabs do function as you describe for “regular browsing sessions”. Can you describe the steps to reproduce your the behaviour that you see? If you’re a Bugzilla user, please do open a bug!

      May 11th, 2012 at 08:51

      1. Mike B

        I’ll go back and check again when I get home, I run the stable version here at work. It is possible what I am seeing is a tab loading that was opened at startup but that I haven’t accessed yet, as opposed to one I opened during that session.

        In that case, I do believe that the background tabs on browser load should load in the background but only after the foreground tab is done.

        And don’t get me wrong, I love the idea that the browser is getting better, the memory management has been greatly improved in the last few versions. Big Firefox fan, and the tab thing has been a minor annoyance, but I figured it was something that was due to me running the beta. If I am able to duplicate it, I will put in a bug report.

        May 11th, 2012 at 14:35

        1. Mike B

          Just a quick update, it was start-up tabs that I had not accessed; tabs opened in the background fully loaded before I switched to them.

          May 11th, 2012 at 19:57

  7. Rami

    See i used to love Firefox, a die hard fan, where ever i’d go i’d tell people, FF is the best period, i’m a web developer, i live in the browser throughout the day, from browsing to facebook to of course the most important part, my work, FF is a hungry ram maniac that eats crazy rams, and when i use it with FireBug damn it’s slow, i switched to chrome, and it’s much faster, the chrome web developer extension even though was a pain in the start but now i prefer it on FireBug, the thing is, you guys started this trend with amazing browsers, back in the days of netscape to the days of FF, you killed the ugly IE and showed the world how important and great could a good web browser be, but later on, i guess FF got bigger and more people were involved and sadly, this made it a worse browser, RIP FF, i will miss you my friend.

    May 11th, 2012 at 08:46

  8. Wayne

    > t gets extremely annoying during regular browsing sessions as it eliminates most of the benefits of opening a background tab. IMO, this (delayed loading) should only use the behavior during browser start, but should load background tabs as normal in regular browsing sessions.

    I quite agree

    May 11th, 2012 at 12:37

    1. cuz84d

      actually Wayne, that is exactly what it doesn’t it doesn’t start loading tabs from a session restore. But normal browsing still works the same. The improvement is so that when startup, its faster, but if you don’t look at all the other tabs, why load them? But when you decide to do it, you click on that tab and it starts loading. Now a better method might include some kind of be delayed loading that is concurrent so that it loads one page at a time starting with the current tab and keeps loading background tabs as you use the browser while not overloading loading tabs all at once like it does now.

      May 11th, 2012 at 13:07

      1. cuz84d

        err, sorry. I meant consecutively it could allow some loading of tab+1 if you actually wanted tabs to continue loading after startup without having to click on each one, but not all concurrently at once like it does now w/o tabs-on-demand.

        May 11th, 2012 at 13:15

  9. Suggestion

    Firefox should focus on this:

    – Best privacy options. Google Chrome will not even *want* to give users more privacy. Make sure users are protected against tracking cookies and stuff like that. I know you are getting lots of money from Google, but if you can, you should focus on this. Users will want it in a few years when they get sick of being followed and tracked. Some of us already are.

    – Best plugin support. You already have this. Just improve it where you see fit.

    – Best multiplatform experience. Already on your way, but default Firefox on Linux is uglier than Chome. Looks matters. You should fix this since its easy to do.

    – Strong HTML 5 support

    – Fast startup time, specially on the mobile versions. Its critical for success!

    – Stop with nonsensical things nobody cares about. You have limited resources so focus on your strenghts.

    May 11th, 2012 at 13:08

    1. Alex

      “Stop with nonsensical things nobody cares about. You have limited resources so focus on your strenghts.” [sic]

      At the same time, it’s an open-source project, so most of the contributors aren’t being paid for any of their work. If they choose things to work on which you happen to think “nobody cares about”, absolutely nothing is lost.

      June 5th, 2012 at 15:12

  10. Hogart

    Don’t let people like Alec bother you. They clearly haven’t been paying attention, and there are many of us who appreciate that you’re still continuing to give Chrome and Opera a run for their money. We all know his kind will simply jump ship the second another shiny browser rolls around, so disregard the trolling.

    May 11th, 2012 at 13:43

    1. taylerz

      I’d like to continue on Hogart’s comment. Ignore Rami too. Not paying attention. Firefox has gotten a lot faster in the past year, not just now. I’ve given Chrome two chances, the most recent one a week long and still found myself coming back to .. Firefox!

      May 12th, 2012 at 06:01

    2. Erunno

      But Alex is right. Mozilla took their sweet time until they started seriously and methodically addressing problems like memory usage (MemShrink) and interface responsiveness (Snappy). The former project started in mid 2011 and the later one at the end of 2011 and work on them will probably continue well into 2013 (plus the time until they reach the stable channel). That’s an awful lot of time considering that Chrome first appeared in September 2008 and set the bar for perceived and actual performance for many use cases (especially those concerning for regular users). Imagine Snappy and MemShrink had been both kicked off in 2009, then Mozilla might not have bled as much market share and mind share.

      May 12th, 2012 at 11:25

  11. Todd

    Lately I have found myself using Safari more than Firefox. I want to use Firefox but I found that the Mac version has not gotten as much love as the Windows one.

    I’d love an updated interface or some Lion tweaks like back and forth gestures, true full screen, and iCloud bookmark syncing! :)

    May 12th, 2012 at 07:14

    1. Ahmad

      LOL! We Windows users complain that Mac gets more love from Firefox..

      May 12th, 2012 at 11:16

    2. Jean-Yves Perrier

      True full screen is coming in Firefox 14 (if all goes well). It is currently tested on the Aurora channel.

      May 13th, 2012 at 00:28

  12. Sandro

    Tabs -on-Demand is FANTASTIC news. I was waiting for it for years…

    May 12th, 2012 at 07:25

  13. eddie

    This week my laptop was unusable, and I launched the Task Manager and Firefox was using 4 GB of RAM. I had enough. I have been angry for a ling time with Firefox turning my i7 into a 80486. I have now removed Firefox from all my computers.

    With the same workload, Chrome takes so much ram as Firefox, but Chrome shares the load among processes, and as result the computer is responsive, it does not behave like an 80486 and it does not turns on the heavy churning of my swap.

    Having just one process and just a couple of processes.does not scale, even if you lazily load tabs, make your garbage collector smarter a la JVM, move to jemalloc or completely rethink spidermonkey/tracemonkey. I’m not going back to Firefox because I don’t want swapping back.

    Now, Mozilla, your move.

    May 12th, 2012 at 14:23

    1. Ferdinand

      “Now, Mozilla, your move.”
      You are wrong it is your move. Either you move to a new browser or you fix your Firefox. You must have seen the tests from independent websites that show that Firefox uses the least amount of memory. So your conclusion should be: either I have found an extremely rare bug in Firefox or I should try a new profile

      May 14th, 2012 at 22:14

    2. alexleduc

      I’m more of a die hard fan than you so it will take much more to get me to switch (I even used NS4 over IE4 out of stubbornness back in the days, even though I thought IE4 was superior). That said, I too am beginning to feel the sting of various performance issues.

      Namely:
      – Too much disk (swap?) access. Unlike other browsers, FF seems to have regular slow downs where you hear the hard disk trashing like crazy.

      – Frequent temporary lockups of the tabs/ui as some page is loaded.

      – YouTube videos often fail to load (tested across different computers) ever since FF4.

      I find myself switching to Chrome(Iron) more and more for some sites (especially YouTube) and, while this is not yet enough to make me switch, I find myself contemplating the idea more and more these day.

      May 28th, 2012 at 07:58

  14. Enrique

    Great news!. Firefox is already really fast when running on Intel hardware (I think people are a bit paranoid when complaining about speed issue in an Intel Core Duo since most of the time we are speaking of tens of a second). Still I’m working in a project with ARM devices with small cache (128/256 Kbs of cache vs 2-6 Mb of Intel) and low clock speed (0.8Ghz) and there any optimisation is worth its price. Specially everything having to do with cache optimisation. Any re-factoring work that can save a single kilobyte of executable-code can noticeable boost performance and responsiveness.

    Congratulations and continue with your great work!

    May 13th, 2012 at 02:28

  15. Christopher Thomas

    I believe he is talking about opening firefox with 10 tabs, from my understanding of the article above, 1 would load and 9 would load on demand.

    so if I finish reading tab 1 after 5 minutes, flick to tab 2, it’ll have to load and run the content at the time that I flick to it.

    it won’t be loaded and ready to go, I think that was his point.

    May 13th, 2012 at 08:33

  16. Ken Vermette

    Whats with the unmitigated hate with some of these comments? I’m reading over and it’s either “You should have done this years ago”, “You should focus on this other thing!”, “I use XYZ now because Firefox got too big”, “Firefox is slow when I use plugin X”, “I don’t like the way it does X so I don’t use it”

    The features important to lots of the people posting here aren’t important to even a fraction of real-world users. I’m a web developer, I love that I can customise Firefox to be a swiss-army-knife, but I’m not going to say that spending another $40,000 a year in manhours to hire someone to work on development tools is the smart thing to do. Same with threading, Mac support, Windows support, Linux Support, HTML standards that aren’t even published yet, performance, etc.

    You could hire five people for each of those, and there’s no guarentee that the hundreds of thousands of dollars it would cost each year would “solve” all the things people complain about.

    Fact is running add-ons known for needing more RAM and complaining “Mozilla hasn’t fixed my RAM” isn’t going to fix anything. Maybe start using the profiles feature and have one profile for development and another for casual browsing. You don’t need firebug on 24/7. Don’t open 47 tabs on a netbook. Understand that perfect KDE/Gnome/XFCE/Ratpoison integration isn’t their biggest priority. Know that “being fast” may not be as important as “being complete”.

    Overhauling X Y or Z might be a good idea, but it might not be worth it compared to other bigger targets. And lastly, if you stopped using FF for some random reason or because some plugin misbehaves when you use it, there’s places to properly report those issues: People came here to read discussion about genuinly interesting enhancements, ask questions, and provide thoughts/feedback about Snappy. We don’t want to read your general complants about unrelated topics.

    So here’s what I wanted to ask about before I was compelled by the complaint-fest…

    Once Firefox is up-and-fully-started will it begin loading the unloaded tabs? Get the UI up, the first page loaded, and then background-load the other tabs once it’s ready? And would Tabs-On-Demand differ in functionality if firefox is starting after a crash?

    Great work Snappy Devs!

    May 13th, 2012 at 10:59

  17. sulfide

    RIP FF. Was good while it lasted. These day’s you’re just too damn slow and use gobs of memory. Your developers went in too many nonsense directions and forgot to work on whats important. They also ruined your UI :(

    May 13th, 2012 at 11:47

    1. Wes

      Oh, you.

      May 13th, 2012 at 15:24

    2. edm

      Firefox now has about the same UI as Chrome and IE. I don’t know if that means it is ruined, but in Chrome and IE you are completely stuck with the UI. In Firefox you can customize it and make it any way you want it. So, it seems to me if you don’t like the new Firefox UI then the only browser choice you have is … Firefox… Oh the irony!

      May 24th, 2012 at 14:59

  18. John Meher

    I am still a die hard Fire Fox Fan!!! I wish I could see more stability, I spend my day in the browser and I have seen some issues with the latest releases and I am always scared to update because my plugins that I use so faithfully are just being knocked off one by one. Never the less I look forward to Firefox’s future! Long live open source!!!

    May 13th, 2012 at 23:21

  19. benjamir

    I use FF 11: “tabs on-demand” enabled via preferences (they don’t load when opening the last session).

    So the most notable “new” features of FF12 or FF13 can’t be tabs on-demand.

    May 14th, 2012 at 00:55

    1. Lawrence Mandel

      As you alluded, tabs-on-demand was preffed off in previous versions of Firefox. In Firefox 13 this feature is now preffed on. This makes Firefox 13 the first release for which the vast majority of users will experience tabs-on-demand.

      May 14th, 2012 at 09:14

    2. Joseph

      Thanks for bringing that up; I thought I was going crazy. I agree with you that toggling a preference from off to on may be a change but not a new feature.

      May 14th, 2012 at 10:52

  20. Walid Damouny

    I’ve always used an extension (search for BarTab) when tabs-on-demand was not a built-in feature of Firefox. I was great because I easily have a hundred tabs or so that I keep as temporary bookmarks so that I can go to later.

    If bookmarks were easier to use I don’t think we would be keeping tabs open for the next session.

    May 14th, 2012 at 09:31

  21. Dinesh

    Great work guys. I am looking forward to using Firefox 13. What I like most about Firefox is that it’s not built my some company trying to get every little piece of private data I have. Keep up the good work! I will always use Firefox although I find myself switching to Chrome for speed but I’ll never give up on Firefox! :)

    May 14th, 2012 at 23:10

  22. brightsmith

    First and most importantly, be careful of INFILTRATORS / SPIES among the developers of Firefox, which may be sent by rivals to slow down the performance of Firefox. Remember that Firefox is the only non-PROFIT web browser that is against all commercial web browsers.

    Please FOCUS on: Page Load Time (uncached and cached), Cache Management (preferably more than 1024 MB), Stability and Reliability (consider multi-process separation), and prioritizing the Windows 7 platform.

    Please DO NOT be too concerned with: Memory Consumption (Memory are getting cheaper), Start Up Time, Hardware Acceleration, and things that are less important.

    May 15th, 2012 at 13:37

    1. alexleduc

      No need to worry about secret spies. I heard the Mozilla team wears tin foil hats 24/7 to block mind control.

      May 28th, 2012 at 10:04

  23. Narcélio Filho

    Firefox uses just one of my four cores for a couple of seconds each time I open some bloated page. Implementing multi-threading (the right way) would give it 100% to 200% performance instantly.

    May 16th, 2012 at 11:48

    1. Ferdinand

      Intel and AMD found out that it doesn’t work that simple. It is really hard to use more than 1 core. Slowly all browsers are trying to use more cores and the GPU but it will take years before we get a 100% speed boost. Let alone a 200% speedboost.

      June 5th, 2012 at 15:16

  24. Brightsmith

    I have tried Firefox 13 Beta 3 (latest), it seems a bit slow when accessing Google via HTTPS (sign in) rather than HTTP (anonymous). But overall, noticeably faster than Firefox 10.

    May 16th, 2012 at 17:29

    1. Walid Damouny

      Although off topic, HTTPS works without signing in. The only difference is that the connection is encrypted and no one can see it, unlike traditional HTTP.

      As for the speed, yes it is slower because HTTPS cannot be cached like the unencrypted HTTP used on regular sites. The reason being the encrypted communication between you and Google is scrambled and there are no parts of the page you are viewing that can be cached by a server (for speed’s sake) in order to serve them back to you when you ask for them.

      May 17th, 2012 at 00:01

  25. leeoniya

    @Alec, who’s late to the party? http://code.google.com/p/chromium/issues/detail?id=105666

    May 17th, 2012 at 09:22

  26. JK

    This tab-no-load thing sounds fishy.. My usual habbit is to restart firefox right after a crash, go fetch a fresh cup of coffee and come back to restored firefox. The reason I had tabs open was because I didn’t want to wait for the content to load, and now to replicate that I’ll have to click on them all after restarting? How many can I click before the UI stops responding? :) If the answer is “all of them”, I guess a bit of manical click click click on startup is fine.

    June 6th, 2012 at 13:04

    1. Lawrence Mandel

      You as the user are in control. If you would prefer all of your tabs to load in the background on restart you can turn off tabs-on-demand under Preferences->Tabs->Don’t load tabs until selected.

      June 6th, 2012 at 14:01

  27. Ferdinand

    You can disable this feature in options>tabs>Don’t load tabs until selected

    June 6th, 2012 at 22:55

  28. Jasjot

    Thanks for the tabs-on-demand feature. FF used to be pretty darn slow in the previous versions, hopefully its quick this time

    June 7th, 2012 at 00:13

  29. Shankar

    One request – for years, I have found it very annoying that Firefox pauses repeatedly (at times for up to twenty seconds) while loading tabs. Is this because I run my system off a flash drive (i.e. am I seeing disk latency?) or is this a result of the cycle collector? This had gotten so bad that I even switched to a barebones browser like Luakit to get away from it for some time. Installing Firefox 13, in the hope that the problem is indeed the cycle collector, and that therefore the new version will be snappier.

    June 14th, 2012 at 23:32

    1. Shankar

      For anyone who may be interested, in my case the problem was partially addressed by using the profile-sync-daemon from Arch Linux (there is a package available for debian / ubuntu as well, and it is just a shell script). Freezes still happen when heavy Javascript is required, but overall there’s a major speed up, so it does seem like the issue was primarily disk latency. Firefox 13 may also have helped a bit. Finally, I switched the sessionstore config variable to 10 minutes rather than 15 seconds.

      July 3rd, 2012 at 01:04

  30. samarendra

    FF is pretty slow and unresposive …

    June 29th, 2012 at 03:57

  31. Bill

    Indeed. My example: 3 open Firefox 13 windows, no tabs, on Win XP, displaying fairly static pages (e.g. LinkedIn pages) with no media, no fancy plugins beyond NoScript … why on earth does Firefox need over 300MB of RAM for this?

    July 18th, 2012 at 10:45

    1. Wes

      Oddly, when I open three linkedin pages in separate windows in Firefox, it’s using around 150MB.
      When I open those three pages in Chrome, the total usage for all of the processes adds up to around 110MB.

      When I move all of the pages in Firefox into a single window with three tabs, memory usage drops by about 30MB.

      July 18th, 2012 at 12:49

  32. Enrique

    Congratulations!!! It looks your work starts to pay off:

    http://lifehacker.com/5917714/browser-speed-tests-chrome-19-firefox-13-internet-explorer-9-and-opera-1164

    August 5th, 2012 at 07:16

  33. Mark

    I’m a heavy “tab-hog” and I LOVE the delayed tab-loading!

    It makes so much difference when restarting FF if you have 2 dozen tabs open, and when you want to use an individual tab, the individual re-load is quite fast.

    I also see the effects of the changes in my memory charge in Task Manager…

    Thumbs UP!

    September 16th, 2012 at 19:25

Comments are closed for this article.