12 March 2011

A day in the life of a browser

If you used the beta version of the 4 for longer, you might have noticed Test Pilot, an add-on designed to collect data about how people are using both Internet and Firefox. It has already delivered some interesting data; some of the results have probably led to the controversial removal of the RSS icon from the default browser installation. Since I use (portable) Firefox at work, I decided to save my results from the test “A week in the life of a browser” and see what information I could extract from them. Because of the nature of the test, I decided to compare the memory use of the browser with the number of opened tabs.

But first let me add some things about my system: an Windows XP SP3 PC with Firefox 4 beta 10. I have completely disabled the Flash plugin because the browser was getting slower every time it was loaded. And the only extension installed is AdBlock Plus. The data was extracted in the week starting with February 1st.

It’s not exactly in a friendly format: every captured event is listed top to bottom along with the date, so it needs some processing before it’s ready to be properly analyzed and graphed. If you’re interested in the raw data, I have saved it online in a Google spreadsheet. After removing some of the less interesting bits I noticed the test captured memory data only for the first day of the period, hence the name of my article. That day I had Firefox running non-stop, so it should give a pretty good picture of memory use over a long period. I also removed a couple of outliers in the tab count: the data reported 2 data points with as many as 40 tabs; I am quite sure I never had that many open!

At first I looked if there is a correlation between the number of open tabs and the amount of memory in use. I was rather surprised to discover it was not the case: rather than using up more memory with more tabs open, it was the other way around: the allocated memory was actually higher for 2-3 tabs than for more than 10!

But when I graphed the memory consumption as a function of time, things got somewhat clearer. The pattern was easy to recognize: every memory indicator (please, don’t ask me what each of them means!) climbs steadily from the start of the day, even in the second half, when the tab count drops under 5 for several hours. At the end of the day the browser ends up using about 100 MB of RAM more than at start-up. It’s a clear indication that the memory management in Firefox still needs improvement, even with basically no extensions and no plugins. Firefox 4 beta memory consumption

Looking back at my first assumption that the memory would be closely tied to the number of tabs, all I can say is that I am probably spoiled by my daily use of ; with separated processes closing some tabs immediately frees up memory. That’s something Internet Explorer also does and I have noticed it while testing the RC of version 9. There is some connection even in Firefox, but as you can see in the graph, the browser is much more sensitive to opening tabs – the memory use climbs right after spikes in number of tabs – than to closing them – memory use stays high a long time after the number of tabs is back to 2 or 3.

Memory management is probably not the most important reason for choosing a browser, but it can affect it’s overall performance and responsiveness. Hopefully Mozilla will adopt the process-separation-model sometime in the upcoming Firefox versions; as I understand, it’s been considered for nearly two years now.

2 comments:

Anonymous said...

For some reason, I can’t see all of this content, stuff keeps hiding? Are you taking advantage of java?

nolvadex

George B. Moga said...

No, the picture in this article is a simple PNG, there is no interactivity needed. Maybe your browser doesn't support the format? Or the domain where it's hosted is blocked...

Post a Comment