O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #9. Make Firefox Go Fast

Don't wait for the Web. Firefox can go faster if you just tune it up a bit.

Here are a few steps you can perform to speed up Firefox. Back to performance basics first, though: the user is the slowest thing attached to the computer. Better use of Firefox's features will speed up the user, so be sure to read the rest of the hacks in this chapter.

Fix Dial-Up Modem Bottlenecks

Any dial-up modem you use is the slowest network hardware you have, so tune it wisely. Make sure any modem connection is running as close as possible to the maximum speed for POTS (plain old telephone system) phone lines. That line is usually a 64 Kb service (unless you're stuck on an ancient analog exchange). No one gets every drop of 64 Kb out of it, unless they pay a fortune for ISDN, but you should get 53.3 Kb at least.

If you're on Windows, your modem driver and chipset should support the latest compression standards now available. Update the modem and the modem's Windows driver directly from the chipset manufacturer. Look on the modem card to see who made the chips; don't bother with who made the card. If you buy a cutoff switch that lets you isolate your answering machine, fax, and telephone gear while you're on the Internet, then you won't strain the line voltage as much, and you'll have less noise causing error-correction delays.

If your connection is still slow, ring your telephone provider and complain that their voltages and noise filters are all wrong—they can test and adjust from their end. Ring Microsoft and complain that Windows hasn't tuned your PPP connection correctly. Ring your ISP and complain that their modem bank isn't negotiating the best possible speed. None of that will do you much good, but it's nice to vent sometimes. Move to broadband.

If you're stuck on dial-up, the biggest performance plus you can get from Firefox without using caching is to turn images off [Hack #35] . That's in the Options dialog box under Web Features. Turning off images might reduce your web experience to an unacceptable low, so it's a dramatic step. You can also change the following preference [Section 1.2.3, in the introduction to this chapter], which ensures that web pages are checked for updates only once per browsing session, instead of every time you look at them:

browser.cache.check_doc_frequency /* set it to 0, normally 3 */

This preference change shouldn't affect you much if you're just surfing idly. If you spend a lot of time with online message boards or similarly intensive web-based applications, it might cause confusion, though, so avoid it in that case. One possible compromise is to create a separate "I'm not working" profile and turn the preference on in that profile. Use that profile for recreation only. Some of the Firefox ad-blocking extensions prevent advertising images from being downloaded, which is a further performance-saving feature.

Overclock Firefox

Some obscure preferences exist that affect the network performance and display performance of Firefox. They're the equivalent of special hardware tweaks that enthusiasts use to make your CPU run faster. There are security implications to modifying the network performance [Hack #16] . They might make you a hazard as you burn down the street. There are also stability risks in cranking up the display performance. Such tweaks are really meant only as debugging tools. If you can't keep your hands off the engine, here's how to proceed without warranty.

Speed up network access

The following preferences might not make you a good web citizen, but they'll get you as much bandwidth as you can manage. Note, however, that too many simultaneous network connections will just slow you down. The best possible performance occurs when there's one connection only and the remote web server is blindingly fast. If web servers or other hops in the network are comparatively slow, try playing with these many preferences.

Turn the following preferences on for dial-up; they produce little effect for broadband connections. A few web pages that don't support HTTP/1.1 will be confused, but all modern web sites should handle it fine:

network.http.pipelining                 /* default = false */
network.http.proxy.pipelining           /* default = false */

Raise the following for dial-up only. It states how many pipelined requests are possible (has a minor effect only):

network.http.pipelining.maxrequests     /* default = 4 */

Set the following higher if you want to hammer web servers with many simultaneous requests (suitable for broadband use only):

network.http.max-connections-per-server /* default = 8 */

Set the following higher if you want to keep an unfair share of web servers that you access a lot. The web server must also be too dumb to deny your request for extra access:

network.http.max-persistent-connections-per-server /* default = 2 */

Set the following higher if you want an unfair share of web proxies that you access a lot. The web proxy must also be too dumb to deny your request for extra access:

network.http.max-persistent-connections-per-proxy /* default = 4 */

Set the following higher if you keep millions of tabs and/or windows open (suitable for broadband use only).

network.http.max-connections /* default = 24 */

Speed up page display

To display pages faster, you first need a fast CPU and memory. Don't try the following things on an ancient Pentium II, unless specifically noted here.

Setting the following preference to false is a brutal performance tweak that tells Firefox to process every byte of Web content as soon as it arrives, rather that buffering it in sensible chunks. This makes Firefox web-page handling work extremely hard but theoretically puts page content on the screen faster (recommended only for burning-hot CPUs with super-fast display cards and dial-up connections):

content.notify.ontimer /* default = true */

An even more brutal tweak shuts out all interruptions (including user input) while the incoming web page content is analyzed (not recommended at all unless Firefox is being used as an untended monitoring station):

content.interrupt.parsing /* default = true */

If content.notify.ontimer sensibly remains false, this is the time-out interval for collecting sensible chunks of incoming web page. Lower it for faster incremental page display. Lower it below 10000, and web-page handling will be working extremely hard again (recommended for dial-up):

content.notify.interval /* default = 120000 (micro-seconds) */

For Granny's slow computer, if nothing's arrived recently, then do extra buffering, which saves more CPU cycles. Set to the number of milliseconds to back off each time the network connection is found to be idle (recommended for ancient PCs on dial-up only):

content.notify.backoffcount /* default = -1, meaning never */

Make Firefox pay more attention to the mouse and keyboard at the expense of other activities. Making this a larger polling delay slows down recognition of user input but marginally improves page display:

content.max.tokenizing.time /* default = 360000 (micro-seconds) */

If the user is in the habit of opening 10 web pages (especially 10 tabs) and then sipping coffee while the pages load, making the following parameter's value larger will speed up page display (recommended for slow CPUs):

content.switch.threshold /* default = 750000 (micro-seconds) */

Make a big memory buffer for big pages. Set to a power of 2 minus 1—e.g., 16385 (recommended for broadband):

content.maxtextrun /* default = 8191 */

Here are a couple of additional oddments. The following preference tells Firefox to start putting received web pages on the screen right away, even if not much content has been received yet:

nglayout.initialpaint.delay /* set to 0, default = 250 (millisecs) */

The following preference tells Firefox not to bother putting image placeholders on the screen while the real images are fetched, which will also speed page display up a bit (recommended for broadband):

browser.display.show_image_placeholders /* default = true , set to false */

Finally, on Linux/Unix, don't run Firefox with X-servers and X-clients on different machines; that can be quite slow. VNC (or PC-Anywhere, or Windows Remote Desktop) does not affect Firefox performance, except for capping the speed at which desktop updates occur. That is not a Firefox-specific effect, though.

Expand Your Caching

Your best defense against a slow network is a big local cache. In the Options panel, make the cache as big as you can manage. It's really the memory part of the cache that provides the performance, so if your computer is low on memory, a big disk cache won't help much. Buy more memory; Firefox will find it and use it. If you want to set the size of the memory cache explicitly, use these preferences:

browser.cache.memory.enable     /* default is true */
browser.cache.memory.capacity   /* -1 = size to fit, 123 = 123 Kb */

Start Up Faster

You can get a faster startup if you turn on Quick Launch when you first install Firefox. Extensions and fancy themes will encumber performance slightly, so you should avoid those. Windows XP is supposed to be smart enough to optimize disk storage of frequently used applications, but it's doubtful that will help much, even if you can figure out how to control it, and even if you defragment the disk.

On Linux, if you use KDE as the default desktop, you pay a lot when Firefox starts up, because it requires the GNOME Gtk subsystem, and that means extra startup effort. You could use GNOME instead, at least until the KDE project's Qt Mozilla port is fully polished and ready.

Ultimate Speed Improvements

Note also that the standard distributions of Firefox for x86 (Intel) architectures are compiled for the lowest common denominator. They're compiled with dynamic link libraries and support everything back to a 386 (OK, that's an exaggeration). In theory, you can get much better performance if you upgrade your compilers to a recent version and compile a static build of Firefox that's also optimized for (say) [Hack #92] . There is some evidence that this will speed up your user experience. It has been shown to reduce the runtime size of Firefox, at least on Linux.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required