Solutions to Firefox using too much CPU on Ubuntu Linux

Ubuntu decided several months ago to forgo its policy of sticking with Firefox 3.6, and go with the latest versions from Mozilla.

With Firefox 13 running on Ubuntu 10.04, I had good performance, and did not suffer from this problem that I am about to describe. The only issue I faced was excessive disk activity and that was fixed by disabling the FireBug extension. Other than that, Firefox was speedy and responsive.

However, things changed when I upgrade to Firefox 14 a week ago, again on Ubuntu 10.04. This was installed 18-July-2012 to be specific, and the version is 14.0.1+build1-0ubuntu0.10.04.1.

Ever since the upgrade, I am seeing high CPU usage, and it is not related to the number of tabs or windows that are open.

With a single tab, with no site loaded, Firefox takes 5% of CPU

To narrow down what is using a lot of CPU, I used oprofile a system wide profiler, with the debugging symbols for Firefox.

The following simple shell script was used:



opcontrol --no-vmlinux --session-dir=$DIR
opcontrol --callgraph=6
opcontrol --start
sleep 15
opcontrol --shutdown

opreport -a -l --session-dir=$DIR

Here is the output from the above script:

samples      %   image-name      app-name       symbol-name
33103    54.22   no-vmlinux      no-vmlinux     /no-vmlinux
 5818     9.53      pref_enumChild
 3934     6.44 __GI___strncmp_ssse3
 1289     2.11   oprofiled       oprofiled      /usr/bin/oprofiled
  752     1.23      PL_DHashTableEnumerate

As you can see, 9.5% are in, in the pref_enumChild() function.

Loading a single tab, with, and with Javascript disabled for it using NoScript.

Same 5% of Firefox usage.

With 5 Windows open, as I used to do with Firefox 13, CPU usage goes up to between 19% to 22% just for Firefox. Same function uses 16% of the calls.

samples     %    image-name      app-name       symbol-name
51944   39.44    no-vmlinux      no-vmlinux     /no-vmlinux
21390   16.24      pref_enumChild
10671    8.10 __GI___strncmp_ssse3
 3007    2.28    oprofiled       oprofiled      /usr/bin/oprofiled
 2669    2.02      PL_DHashTableEnumerate

Something is seriously broken Mozilla, and needs to be fixed.

Anyone has solutions or workarounds for this?

Update: 27 July 2012.

The problem is fixed, but I have no idea what fixed it.

What I did was try the ESR release (10.0.5). I just extracted it, changed to the firefox directory, then run ./firefox. It checked the plugins for compatibility, then started normally. CPU usage was high, the same as Firefox 14.

After that, I launched Firefox 14 normally, and again it checked the plugins. However, this time CPU usage is low again.

Update 27 February 2014

At present, I am on KDE Ubuntu 12.04 64 bit.

After having Firefox eat up close to 50% of the CPU (i.e. one CPU on a dual core laptop), here is what I have done to solve this problem:

1. Disable and remove the FireBug extension. This extension was causing a lot of disk I/O, and slowing down the entire laptop.

2. Disable and remove the YSlow extension. This was causing the CPU usage to spike to 50%, and the fan to go on continuously. Once disabled, the CPU usage by Firefox is between 2% and 10%.

See Also

Ubuntu has opted to go for the latest releases, which may cause surprises. What I did is to install Firefox ESR on Ubuntu 12.04 64 bits.




firefox in 2013?

I have used linux for years and after chrome is came the firefox is disappear from my life as from life of many other ubuntu users and linux users at all. sorry but is there any reason to use firefox? it always used and uses high cpu especially at linux system.

I had a similar problem,

I had a similar problem, firefox slows down my computer terribly. I've been desperate enough that I wanted to change to chrome. But we know with google chrome we have got zero privacy. It turned out that one of the plugs going crazy, this extension consumed huge amounts of resources. It is worthwhile to test it and turn off each part of the plug-ins and see if your firefox will work faster. Maybe it was the same with your firefox?