Firefox Performance Tweaks

Over time I have been collecting various Firefox tweaks… this is my collection of performance tweaks that i used to tame down Firefox 2.x on Mac. These work on all platforms but they really helped with the mac version too 🙂

Firefox Excessive Memory Usage

1. Within Firefox, enter “about:config” (minus the quotation marks) in the address bar

2. Scroll down to the entry “browser.sessionhistory.max_total_viewers” and double-click it.

3. In “Enter integer value” field, type..

* “0” to disable the cache

* “1” through “8” to set the maximum cache as 1 through 8 previously-viewed pages

* “-1” to return the cache to its default

Max Total Viewers

To improve performance when navigating (studies show that 39% of all page navigations are renavigations to pages visited < 10 pages ago, usually using the back button), Firefox 1.5 implements a Back-Forward cache that retains the rendered document for the last few session history entries. This can be a lot of data. It’s a trade-off. What you get out of it is faster performance as you navigate the web.

For those who remain concerned, here’s how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. When set to this value, Firefox calculates the amount of memory in the system, according to this breakdown:

RAM Number of Cached Pages

32MB 0

64MB 1

128MB 2

256MB 3

512MB 5

1GB 8

2GB 8

4GB 8

(reference: nsSHistory.cpp)

No more than 8 pages are ever cached in this fashion, by default. If you set this preference to another value, e.g. 25, 25 pages will be cached. You can set it to 0 to disable the feature, but your page load performance will suffer.

Ram Cache

There’s a type-ahead feature, so just start typing. Once you get there, check to make sure its “Value” setting reads “true,” then follow these steps:

1. Right-click any blank area in the about:config window and choose New > Integer from the pop-up menu.

2. The New Integer Value box will open. Copy and paste this setting name into the open dialog box: browser.cache.memory.capacity

3. In the Enter Integer Value box that opens, enter -1 to preserve Firefox’s default operational mode.

4. To customize the setting to your computer’s physical memory, consult this MozillaZine page. For RAM sizes between 512BM and 1GB, start with 15000. For RAM sizes between 128MB and 512M, try 5000. Note: If you have less than 128MB of RAM, that’s probably the cause of your Firefox issues.

* 32 MB of RAM -> 2 MB

* 64 MB of RAM -> 4 MB

* 128 MB of RAM -> 6 MB

* 256 MB of RAM -> 10 MB

* 512 MB of RAM -> 14 MB

* 1024 MB of RAM -> 18 MB

* 2048 MB of RAM -> 24 MB

* 4096+ MB of RAM > 32+MB

Trim on minimize

1. Open Firefox and go to the Address Bar. Type in about:config and then press Enter.

2. Right Click in the page and select New -> Boolean.

3. In the box that pops up enter config.trim_on_minimize. Press Enter.

4. Now select True and then press Enter.

5. Restart Firefox.

Network tweaks

1. Type “about :config” in the adress field.

2. Set the value of network.http.pipelining to “true”.

3. Set the value of network.http.pipelining.maxrequests to “100”.

4. Set the value of network.http.proxy.pipelining to “true”

5. Create an integer called nglayout.initialpaint.delay and set it to “0”

Limit RAM usage

All versions: Goodness knows I’ve done a good amount of belly-aching about Firefox’s voracious appetite for RAM. (It’s consistently the most memory-intensive process on both my PC and Mac.) Happily a simple config tweak got Mem Use right back down to a more comfortable number. Along with the previous prefetch mod, set your browser.cache.disk.capacity browser.cache.memory.capacity to a value that fits your total RAM.

* Key: browser.cache.memory.capacity

* Modified Value: Depends on your system’s total memory. According to Computerworld:

For RAM sizes between 512BM and 1GB, start with 15000. For RAM sizes between 128MB and 512M, try 5000.

Fetch only what you click

Fx .6 and up: Firefox has this wacky little feature that downloads pages from links it thinks you may click on pages you view, like the top result on a page of Google results. This means you use up bandwidth and CPU cycles and store history for web pages you may not have ever viewed. Creepy, eh? To stop that madness, set the network.prefetch-next key to false.

* Key: network.prefetch-next

* Modified Value: false

Well thats all for now… Check back for more Firefox tweaks.