STREAM OF CONSCIOUSNESS

Tips For a Fast Firefox on Linux

April 24, 2010

Here are some tips that I find most effective to speed up Firefox on Linux. Except tip #1, they should also be applicable on other platforms.

1. Move Firefox profile database to memory

Firefox uses SQLite to store most of the permanent information like history, cache, bookmarks, etc. Although SQLite is a very fast database, Firefox queries it very frequently thus that makes Firefox an IO-bound application.

The idea of this tip originates from a topic in the Gentoo forums. There are posts that explains how to do that in Linux and OSX.

After applying this tip, you should notice a enormous speed up. For example, going back and forward should be almost instant.

Here is a script that moves profile files to memory and runs firefox. When firefox exits it automatically updates the profile on the disk. (Note: Be sure /dev/shm is mounted on your machine or create a path that uses tmpfs)

#!/bin/bash

# run first: mv .mozilla .mozilla.orig

cd $HOME
/bin/mkdir /dev/shm/mozilla
/bin/mkdir .mozilla
sudo /bin/mount --bind /dev/shm/mozilla .mozilla
/bin/rm -rf .mozilla/*
/bin/cp -r .mozilla.orig/* .mozilla/
/usr/bin/firefox
/usr/bin/rsync -av --delete .mozilla/ .mozilla.orig/

2. Use Firebug on a different profile

You should already noticed that when Firebug is active pages become performing much slowly. You can think that when you deactivate the Firebug on the page it will be back to normal. No! Unfortunately, as long as the Firebug is active as an addon, it disables the Firefox’ high-performance Javascript JIT compiler to get debugging information. You can read more about it here.

To overcome this problem you can create two profiles: one for casual browsing and one for web development. For browsing profile, you should install a minimum number of addons that you want to use while browsing. For development profile, you can install Firebug and other development related addons.

Profile Manager can be started with this command:

$ firefox -ProfileManager

Using the default profile will be okay for browsing. You can create one more profile named “dev”, for example.

To start browsing profile run it without any parameters:

$ firefox

To start development profile run it with the profile parameter:

$ firefox -P dev -no-remote

I recommend using the -no-remote parameter because when the browsing profile is running it sometimes opens a new window in the browsing profile rather that starting development profile.

It will be very convenient if you define aliases for these commands like “firefox” and “firedev”.

3. Disable not used addons

Every addon you install will slow down Firefox in a varying amount. So try to remove addons that you don’t use much. Feel free to try disabling a few addons and you should notice a speed up.

Also, as in the tip #2, you can try moving some of the addons that you don’t use frequently to a different profile.

About

My name is Ertuğ Karamatlı. I'm working at sahibinden.com and also studying MS in Software Engineering at Boğaziçi University. Contact me at ertug@karamatli.com.

home · rss · knowledge base · research · résumé · twitter · github