nullstream weblog - Suspend Firefox


« Amazon and Netflix | traceroute + ping = mtr »

Suspend Firefox

Apple

July 30, 2009 10:08 PM PST

Firefox 3.5 does a bit better on memory usage with a lot of (50+) tabs. Still, the various Javascripts, Java and Flash animations all use CPU, and Firefox for me typically runs at 20% CPU or so on my Macbook Pro. There are a couple things you can do to reduce the CPU usage, and then the ultimate solution to quickly suspend Firefox.

Initially, you can install the Adblock Plus extension, which will block all ads, with the side effect of using less CPU loading and displaying flashing gifs, etc. Flashblock is another good extension that shows all flash objects as a blank rectangle with a play button in the center. The flash object will only load when the play button is pressed. You'd be surprised how many tiny flash objects are embedded pages, using CPU.

Finally, you can suspend the Firefox process and effectively move its CPU usage to 0%. I typically hit <command>-h to hide all Firefox windows, and then type the following to susupend and resume in Terminal.app:

killall -STOP firefox-bin
killall -CONT firefox-bin

It would be nice to integrate these commands when an app is hidden or shown, but for now this hack is good for saving battery life, or keeping your CPU cooler in hot weather!


Comments (10)

John, August 3, 2009 01:14 PM:

Firefox? Oh right I remember that.

killall?? Seems you are assuming a particular OS with that suggestion.

Paul, August 3, 2009 04:53 PM:

It's not generally a good idea to suspend Firefox like that since it does do useful work in the background. For example, it periodically updates its phishing and malware black lists every 30 minutes or so (I implemented this feature for Chrome). By suspending, you'll get all the updates at once which could cause more disk thrashing when you restart.

J, August 3, 2009 11:32 PM:

John - yeah, FIREFOX. This post is tagged Apple! UR Chrome run on mac and have adblock?

Paul, you're probably right. Although the cpu usage goes way down, window manager sometimes jumps way up in usage. Still, seems a workable, if brutal approach. Please to implement "suspend worthless animations and javascripts" in Chrome please!

John, August 4, 2009 01:08 PM:

Yes my Chrome does run on mac, although not very well :(. As for adblock, there are other, brute force methods available.

Paul, August 4, 2009 04:07 PM:

What are yous talking about? I'm completely Chrome on Mac with the exception of sites that require flash (which are pretty much restricted to YouTube and Hulu).

John, August 5, 2009 12:33 AM:

Paul - you and your daily dev builds. When are you guys going to drop another public build for the rest of us?

J, August 5, 2009 01:16 PM:

Yeah, so to get chrome on mac, I should be pulling right from the SVN repository? I suppose it would be worth a try if you say it's pretty stable now. Primarily I'd like to run heavy web apps in there, like gmail apps and facebook.

Paul, August 5, 2009 02:32 PM:

You don't need to build from source to run the latest code, we have developer channel builds that auto-update approximately every week which is what I'm using.

Here's where you can get the build, scroll down to the Mac section.

Paul, August 15, 2009 09:41 PM:

The latest Mac dev channel release now has flash working, which is useful. Scroll speed, which is what I'm currently working on, is still too slow however.

owen, August 24, 2009 07:14 PM:

I like this idea of killall!

I use xmonad on linux. Would be nice if there is a way to automatically call killall when firefox window lose/gain focus. Anyone?






All links will be marked with the nofollow tag, making them useless for search rankings. Any posts containing spam URLs will then be deleted.