Firefox/Iceweasel high CPU usage when idle

Firefox is called Iceweasel in the Debian SO because of trademark issues. I’ll use the name Iceweasel since that’s what I tested but everything here’s applicable to Firefox.

This came to my attention thanks to user SynrG in the #debian IRC channel. When Iceweasel is just idling in some sites it will eat an unreasonable amount of CPU time even when nothing is being updated on the screen. This was tested browsing Facebook but it’s not specific to this site. The high CPU usage went away just switching to another tab with an unaffected site open. It’s more noticeable on old hardware, like my netbook, with a fake dual-core Intel Atom CPU, it was around 100% all the time and made the computer lag. More powerful multi-core CPUs will see an inferior usage and maybe no lag but still some CPU time is wasted by Iceweasel when idle. Disabling Javascript will do nothing so it isn’t some Javascript running in the background.

The problem lies in CSS3 animations. There’s a bug in Iceweasel that makes it refresh the page even when nothing is changing whenever there’s a animation property set to an element even when the element is hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=962594.

The easy fix is disabling animations but since this can’t be done with any preference setting we need to use user styles as a workaround. This can be useful to solve the problem until this bug gets a proper fix.

You just need to put a userContent.css file in a chrome folder inside your profile folder. If you want to disable the animation property for all sites you can use these lines:

* {
  -moz-animation: none !important;
  animation: none !important;
 }

In case you don’t want to disable animations for all sites but just a few look at the following example for Facebook:

@-moz-document domain(facebook.com) {
* {
  -moz-animation: none !important;
  animation: none !important;
 }
}

More information about matching options in the MDN.

Advertisements

6 comments

  1. Pingback: Invisible CSS animations on Iceweasel consuming CPU | syn.theti.ca

  2. Whaaaoo, nice work ! I was completely aware of this bug, creating a huge consumption of CPU while browsing Facebook or other websites, but I had absolutely no idea how to fix it. Thanks a lot !

  3. This is a great fix. I was having CPU issues (constant 35%-50% usage by Firefox) while surfing traffic exchanges on my 64-bit Linux box. A couple were refreshing their surfbars (where you click for the next site) every few seconds, and my machine was constantly upping the fan speed on this warm Spring night here in Sydney, even when I wasn’t actively surfing. Now that I’ve applied the fix recommended here Firefox is sitting between 1% & 3% & my CPU temp has dropped by around 20 degrees Celsius.

  4. Pingback: Instalando y configurando un escritorio para un usuario de Debian 7 en un equipo modesto | Chicoloapan Grupo de Usuarios GNU con Linux


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s