## 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: