Wednesday, April 27, 2011

Firefox Speed Tweaks

1) Tweak the page render time from 250ms to 0ms.
This value is the amount of time the browser waits before it displays the web page. Mozilla applications render web pages incrementally - they display what's been received of a page before the entire page has been downloaded. Since the "start" of a web page normally doesn't have much useful information to display, Mozilla applications will wait a short interval (default: 250ms) before first rendering a page. But with fast broadband connections you can set this to '0' and get a nice speed boost!

How:
Open the Firefox “config” page: click into the Firefox address location bar, and type about:config, and press Enter. The Config file will appear in the Firefox browser.
Right-click, New, integer. Type 'nglayout.initialpaint.delay' and set to '0'.

2) Turn on http pipelining, a technique in which multiple HTTP requests are written out to a single socket without waiting for the corresponding responses. This results in a dramatic improvement in page load times. Normally the browser will make one request to a web page at a time, but when you enable pipelining it will make several at once. How:
In the about:config page, filter on this text 'pipel', which will display this:
firefox-http-pipelining.jpg
Set your settings as follows:
network.http.pipelining: true
network.http.pipelining.maxrequests: 8 (screenshot shows '100' but it maxes out at 8)
network.http.proxy.pipelining: true

3) Increase RAM cache setting value for 'browser.cache.memory.capacity'
When images are loaded, they can be cached so they don't need to be decoded or uncompressed to be redisplayed. This reduces the amount of network activity to reload previously viewed messages. This preference controls the maximum amount of memory to use for caching decoded images, messages, and chrome items (application user interface elements). By default it is set to '-1' to automatically decide the maximum memory to use to cache decoded images, messages, and chrome based on the total amount of RAM. Here's the default values depending on your RAM:
Physical RAM Memory Cache (in KB)
32 MB 2048
64 MB 4096
128 MB 6144
256 MB 10240
512 MB 14336
1 GB 18432
2 GB 24576
4 GB 30720
8 GB and up 32768
The default values are a bit on the low-side. For instance, I have 16GB on my PC, so I can easily bump the automatic 32676 setting to double or even triple that. If you set this to a high fixed value you will see noticeably improved back/forward button performance while going many steps back/forward within Firefox.

How:
In the about:config page, you can search for 'browser.cache.memory.capacity'. If it's not there, just add it with the type 'Integer' and set the Integer value to a high value. I set mine to 131072.

4) This tweak is debatable. I've read changing content.notify.backoffcount can improve performance. What does this parameter do? According to Mozilla, "Rather than wait until a page has completely downloaded to display it to the user, Mozilla applications will periodically render what has been received to that point. Because reflowing the page every time additional data is received greatly slows down total page load time, a timer was added so that the page would not reflow too often. This preference controls the maximum number of times the content will do timer-based reflows. After this number has been reached, the page will only reflow once it is finished downloading."

So, if a page reflows too often, it can slow down your browser. This was probably more true when on pokey dial-up connections where some of the images would load but not finish and depending on the size of the image, it could reflow the text incorrectly until another image loaded or the css stylesheet finished loading, etc. Nevertheless, if you want to try this tweak, I read setting it to '5' works well. So Firefox will reflow 5 times, and then on the 6th time, it will just wait for the page to completely load instead of reflowing the entire page again. But if you want to give it a go:

How:
In about:config, set content.notify.backoffcount = 5

5) Enable Windows to swap memory Firefox is using from RAM onto the hard disk. Benefits: Frees up RAM Firefox is using, so that Firefox is only using about 10MB when minimized. As a side benefit, this seems to help with the "memory leak" that Firefox is known for. Somehow when you minimize Firefox, and then restore it, Firefox does NOT use as much RAM as it did previously. So no need to restart Firefox periodically! Drawback: It can cause a delay when the program is restored since it has to read from your hard disk instead of RAM.

How:Set config.trim_on_minimize to 'true' (If this doesn't exist in about:config, add it as a Boolean value). Make sure Network.prefetch-next = 'true'. Source: http://blog.tmcnet.com