Tuesday, January 25, 2011

Firefox still holding its own, for me

I have heard a lot of stuff online bad mouthing the Firefox web browser, especially in relation to the Google Chromium browser.  Most notably, I have heard people state that Firefox has a memory leak (which people should really state as "uses too much memory,"  I hold to a fairly traditional definition of "memory leak"), and has a slow Javascript engine.  There definitely appears to be some validity regarding these complaints, even if the wording is slightly off.  Firefox does utilize a lot of memory and it appears to rate lower in benchmarks and Javascript video games than Chromium.

A new complaint I have heard from my office mate recently is that Firefox uses more CPU than necessary for windows or, more appropriately tabs, that are not currently displayed.  He suggested I should consider trying Chromium since I am often annoyed at how much background CPU I find Firefox occupying.  As stated in previous posts, I am very sensitive to CPU usage in a very literal sense.  The skin on my hands and lap are very sensitive to the rise in temperature due to stray computation on my aluminum bottomed, first generation, MacBook Pro.  I have gone so far as to make a script that toggles freezing any Firefox and Adobe Flash processes on my system so I can force Firefox to stop doing anything when I don't need it.  Anyway, I decided to give Chromium a try as an alternative with hopes that it would use less background CPU.

Now, I'm not sure I'm the average user, but I think that there are many out there that have a lazy, clutter filled mind such as mine.  Let me describe my typical habits when using Firefox.  I tend to let projects build up, and tabs in my browser have only facilitated this behavior.  At any given time, I usually have more than 30 tabs open.  Right now I have around 36, I have seen upwards of 45, but Firefox's background CPU usage usually persuades me to move tabs to bookmarks and or drop something I find interesting because I don't have the time.  Each tab takes up a little CPU, especially if the pages periodically check in with the server.  It seems my friend was wrong though.  Firefox handles my use case much more elegantly than Chromium.

A snapshot of top when Firefox and Chromium are both open with the same set of tabs.  Note that %CPU is double what it is below as top measures percent per core.  Both programs are not doing anything, although Firefox may have been coming in and out of focus during this test (Chromium is on another workspace).

Looking at the process and how much they are loading the system, we see that Firefox weighs in pretty heavy:

smithzv@ciabatta:~$ ps -ausmithzv -eo pcpu,size,pmem,comm | grep firefox
 0.0   304  0.0 firefox
 7.6 484264 16.5 firefox-bin
smithzv@ciabatta:~$ ps -ausmithzv -eo pcpu,size,pmem,comm | grep plugin
 1.2 92000  1.7 plugin-containe

The Firefox program acts as a monolithic blob except for the Flash plugin which is kept in a separate process.  It can be quite shocking how much load it's placing on the system; around 8.8 percent CPU and 18.2 percent of the RAM.  Chromium, on the other hand, is split among many different sub processes.  Let's take a look there:

smithzv@ciabatta:~$ ps -ausmithzv -eo pcpu,size,pmem,comm | grep chromium
 2.1 157892  3.2 chromium-browse
 0.2  2316  0.3 chromium-browse
 0.0 10908  0.5 chromium-browse
 3.9 90556  2.6 chromium-browse
 4.9 85524  2.1 chromium-browse
 0.1 10520  0.6 chromium-browse
 0.1 63736  1.9 chromium-browse
 0.0 16000  0.8 chromium-browse
 3.4 58412  1.4 chromium-browse
 0.0 53500  1.2 chromium-browse
 0.1 62696  1.7 chromium-browse
 0.0 54680  1.2 chromium-browse
 0.1 60872  1.5 chromium-browse
 1.5 82252  2.3 chromium-browse
 0.6 89188  2.4 chromium-browse
 0.0 55596  1.3 chromium-browse
 0.0 56424  1.3 chromium-browse
 0.0 17840  0.8 chromium-browse
 0.0 51752  1.1 chromium-browse
 0.1 59376  1.5 chromium-browse
 1.9 61228  1.6 chromium-browse
 0.0 56260  1.3 chromium-browse
 0.1 56552  1.3 chromium-browse
 0.3 57656  1.4 chromium-browse
 0.0 16000  0.7 chromium-browse
 0.0 56824  1.3 chromium-browse
 0.0 10600  0.6 chromium-browse

We see that the Chromium processes add up to 19.4 percent CPU, over twice what Firefox is using and 37.9 percent of the RAM, again around twice that of Firefox.  I'm not sure anything can be understood from the memory usage, but the CPU usage is pretty cut and dry.  That said, I did notice when playing with Chromium, that tabs don't scroll like they do in Firefox, but rather squish together.  At around the 30 tab mark, all you can see is the icons for each tab, soon after that any identifying characteristic disappears completely.  So I don't think I would ever keep so many tabs remain open since I wouldn't be able to read the title of the tabs I am working with.

No comments :

Post a Comment