From ArchWiki
< Firefox
Revision as of 03:46, 16 December 2012 by Thestinger (Talk | contribs) (Improve font rendering by disabling pango: how exactly does this "improve" font rendering?)

Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end


Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.

Note: Always use the latest version of Firefox.

Advanced Firefox options

This section contains advanced Firefox options for performance tweaking. For additional information see this Mozillazine forum post.

Network settings

Advanced network settings can be found on the about:config page (try searching for network).

Recommended values for a 1.5Mb connection
Key Value Description
network.http.pipelining true Enable pipelining for normal connections
network.http.proxy.pipelining true Enable pipelining for proxy connections
network.http.pipelining.maxrequests 8 Maximum HTTP requests per pipeline
network.http.max-connections 64 Maximum number of total HTTP connections
network.http.max-connections-per-server 16 Maximum number of any type of connections per server
network.http.max-persistent-connections-per-proxy 16 Maximum number of keep-alive type connections per proxy
network.http.max-persistent-connections-per-server 8 Maximum number of keep-alive type connections per server
network.dns.disableIPv6 true Disable IPv6 support
Note: These settings need to be configured based on your connection.

Turn off anti-phishing

Note: Deleting files from your profile folder is potentially dangerous, so it is recommended that you back it up first.

The anti-phishing features of Firefox may cause Firefox to become slow to start or exit. The problem is that Firefox maintains an Sqlite database that can grow quite big which makes reading and writing slower after repeated use. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:

  • Turn off the following options under the security tab in preferences: "Block reported attack sites" and "Block reported web forgeries".
  • Delete all files beginning with urlclassifier in your profile folder (~/.mozilla/firefox/<profile_dir>/):
$ rm -i ~/.mozilla/firefox/<profile_dir>/urlclassifier*
Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size.

Stop urlclassifier3.sqlite from being created again

If you did remove all the urlclassifier* files as mentioned above, you may find out that urlclassifier3.sqlite keeps growing again after a certain time. Here is a simple solution to avoid it for now and ever.

$ cd ~/.mozilla/firefox/<profile_dir>
$ echo "" > urlclassifier3.sqlite
$ chmod 400 urlclassifier3.sqlite

This effectively makes the file empty and then read-only so Firefox cannot write to it anymore.

Other modifications

This section contains some other modifications that may increase Firefox's performance.

Reduce load time by compressing the Firefox binary with UPX

UPX is an executable packer that supports very fast decompression and induces no memory overhead. It can be installed with the upx package, availalble in the official repositories.

Before using upx to compress the Firefox executable, make a backup of the binary:

# cp /usr/lib/firefox/firefox /usr/lib/firefox/firefox.backup

Finally, invoke upx, applying the best possible compression level:

# upx --best /usr/lib/firefox/firefox

Defragment the profile's SQLite databases

Warning: This procedure may damage the databases in such a way that sessions are not saved properly.

In Firefox 3.0, bookmarks, history, passwords are kept in an SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve start-up and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.

profile-cleanerAUR in the AUR does just this.

Sample size differences comparison
SQLite database Size Before Size After  % change
urlclassifier3.sqlite 37 M 30 M 19 %
places.sqlite 16 M 2.4 M 85 %

Cache the entire profile into RAM via tmpfs

If the system has memory to spare, tmpfs can be used to cache the entire profile directory, which might result in increased Firefox responsiveness.




Configure the DPI value

Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96. Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type about:config into the address bar and set layout.css.dpi to 0.

In Xfce, the above method only affects the Firefox user interface's DPI settings, but web page contents still use a DPI value of 96, which may look ugly. A solution is to change layout.css.devPixelsPerPx to system's DPI divided by 96. For example, if your system's DPI is 142, then the value to add is 142/96 = 1.48. Changing layout.css.devPixelsPerPx to 1.48 makes web page contents use a DPI of 142, which looks much better.

Default font settings from Microsoft Windows

Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.

Proportional: Serif Size (pixels): 16
Serif: Times New Roman
Sans-serif: Arial
Monospace: Courier New Size (pixels): 13

General user interface CSS settings

Firefox's user interface can be modified by editing the userChrome.css and userContent.css files in ~/.mozilla/firefox/<profile_dir>/chrome/ (profile_dir is of the form, where the hash is an 8 character, seemingly random string and the profile name is usually default).

Note: The chrome/ folder and userChrome.css/userContent.css files may not necessarily exist, so you have to create them.

This section only deals with the userChrome.css file which modifies Firefox's user interface, and not web pages.

Change the font

The setting effectively overrides the global GTK+ font preferences, and does not affect webpages, only the user interface itself:

* {
    font-family: "FONT_NAME";

Hide button icons

Enables text-only buttons:

.button-box .button-icon {
    display: none;

Hiding various tab buttons

These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.

/* Tab bar */

.tabbrowser-strip *[class^="scrollbutton"] {
    /* Hide tab scroll buttons */
    display: none;

.tabbrowser-strip *[class^="tabs-alltabs"] {
    /* Hide tab drop-down list */
    display: none;

.tabbrowser-strip *[class^="tabs-newtab-button"] {
    /* Hide new-tab button */
    display: none;

Horizontal tabs

To place the tab bar horizontally stacked along the sides of the browser window:

/* Display the tabbar on the left */
#content > tabbox {
    -moz-box-orient: horizontal;

.tabbrowser-strip {
    -moz-box-orient: vertical;
     * You can set this to -moz-scrollbars-vertical instead,
     * but then the scrollbar will *always* be visible.  this way
     * there is never a scrollbar, so it behaves like the tab bar
     * normally does
     overflow: -moz-scrollbars-none;

.tabbrowser-tabs {
    -moz-box-orient: horizontal;
    min-width: 20ex;   /* You may want to increase this value */
    -mox-box-pack: start;
    -moz-box-align: start;

.tabbrowser-tabs > hbox {
    -moz-box-orient: vertical;
    -moz-box-align: stretch;
    -moz-box-pack: start;

.tabbrowser-tabs > hbox > tab {
    -moz-box-align: start;
    -moz-box-orient: horizontal;

Auto-hide Bookmarks Toolbar

#PersonalToolbar {
    visibility: collapse !important;

#navigator-toolbox:hover > #PersonalToolbar {
    visibility: visible !important;

Remove sidebar width restrictions

/* remove maximum/minimum  width restriction of sidebar */
#sidebar {
    max-width: none !important;
    min-width: 0px !important;

Web content CSS settings

This section deals with the userContent.css files in which you can add custom CSS rules for web content. You can import other CSS files by adding to the file:

@import url("./imports/some_file.css");

Block ads

    display: none !important;

Block certain parts of a domain

@-moz-document domain( {
    div#header {
        background-image: none !important;

Add [pdf] after links to PDF files

/* add '[pdf]' next to links to PDF files */
a[href$=".pdf"]:after {
    font-size: smaller;
    content: " [pdf]";

Show URLs at the bottom of the screen when hovering a link

a[href]:hover {
    text-decoration: none !important;

a[href]:hover:after {
    content: attr(href);
    position: fixed; left: 0px; bottom: 0px;
    padding: 0 2px !important;
    max-width: 95%; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
    font:10pt sans-serif !important;
    background-color: black  !important;
    color: white !important;
    opacity: 0.7;
    z-index: 9999;


Mouse wheel scroll speed

To modify the default values (i.e. speed-up) of the mouse wheel scroll speed, go to about:config and search for mousewheel.withnokey. This should show multiple options, modifying the following:

  • Set mousewheel.withnokey.sysnumlines to false.
  • Set mousewheel.withnokey.numlines to the desired number of lines per scroll into the box (12, for example).

Restart Firefox for this setting to take effect.

Alternatively you can install the SmoothWheel add-on.

Change the order of search engines in the Firefox Search Bar

To change the order search engines are displayed in:

  • Open the drop-down list of search engines and click Manage Search Engines... entry.
  • Highlight the engine you want to move and use Move Up or Move Down to move it. Alternatively, you can use drag-and-drop.

How to open a *.doc automatically with Abiword or LibreOffice Writer

Go to Preferences > Applications and search for Word Document (or Word 2007 Document for *.docx). After finding it, click the drop-down list and select Use other.... From there you have to specify the exact path to the Abiword or Writer executable (i.e./usr/bin/abiword or /usr/bin/lowriter).

Secure DNS with DNSSEC validator

You can enable DNSSEC support for safer browsing.

Adding magnet protocol association

In about:config set network.protocol-handler.expose.magnet to false.

The next time you open a magnet link, you will be prompted with a Launch Application dialogue. From there simply select your chosen torrent client. This technique can also be used with other protocols.

Prevent accidental closing

If you experienced accidental closing due to Alt+q keybind, just add a rule in your window manager configuration file. For example in openbox add

 <keybind key="C-q">
   <action name="Execute">

in the <keyboard> section.

See also