Performance

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: Listed options may only be available for the latest version of Firefox.

This section contains advanced Firefox options for performance tweaking. For additional information see these MozillaZine articles.

Enable OpenGL Off-Main-Thread Compositing (OMTC)

To check if OpenGL OMTC is enabled, go to about:support and under the "Graphics" section look for "Compositing". If it reports "Basic", OpenGL OMTC is disabled; if it reports "OpenGL" it is enabled.

If OpenGL OMTC is disabled, you can force-enable it by going to about:config and enabling layers.acceleration.force-enabled. Restart Firefox for changes to take effect.

Warning: If OpenGL OMTC is disabled for a specific hardware, it may be due to stability issues, high system resources consumption, driver bugs or a number of different variables, and so instead of speeding things up it might slow them down. Proceed with force-enabling it at your own risk, benchmark if you aren’t sure.

Enable Accelerated Azure Canvas

Go to about:config, accept the warning, right click and create a new boolean value. Set the name as gfx.canvas.azure.accelerated and set it to true.

To verify restart Firefox then go to about:support and search for AzureCanvasAccelerated which should be set to 1.

The acceleration efficiency can be tested by comparing the speed of a javascript demo with and without the setting.

Stop urlclassifier3.sqlite from being created again

Removing all urlclassifier* files can prevent the use of megabytes of storage in your firefox profile. If you remove all the urlclassifier* files, 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.

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

Turn off the disk cache

Every object loaded (html page, jpeg image, css stylesheet, gif banner) is saved in the Firefox cache for future use without the need to download it again. It is estimated that only a fraction of these objects will be reused, usually about 30%. This because of very short object expiration time, updates or simply user behavior (loading new pages instead of returning to the ones already visited). The Firefox cache is divided into memory and disk cache and the latter results in frequent disk writes: newly loaded objects are written to memory and older objects are removed.

Add the entry (right click > new > integer) browser.cache.memory.capacity and set it to the amount of KB you want to spare, or to -1 for automatic cache size selection (skipping this step has the same effect as setting the value to -1)

This method has some drawbacks:

The content of currently browsed webpages is lost if the browser crashes or after a reboot, this can be avoided using anything-sync-daemon or any similar periodically-syncing script so that cache gets copied over to the drive on a regular basis

The settings need to be configured for each user individually

Longer interval between session information record

Firefox stores the current session status (opened urls, cookies, history and form data) to the disk on a regular basis. It is used to recover a previous session in case of crash.
The default setting is to save the session every 15 seconds, resulting in frequent disk access.

To increase the save interval to 10 minutes (600000 milliseconds) for example, change in about:config the setting of browser.sessionstore.interval to 600000

To disable completely this feature, change browser.sessionstore.resume_from_crash to false

Referrer header control

Defragment the profile's SQLite databases

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

Firefox keeps bookmarks, history, passwords in 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.

Firefox provides a tool to defragment and optimize the places database, which is the source of most slowdowns and profile corruptions. To access this tool, open the about:support page, search for Places Database and click the Verify Integrity button.

Cache the entire profile into RAM via tmpfs

Enable Electrolysis

Note: Electrolysis should always be enabled in Firefox 57 and later

Electrolysis (multi-process) may be enabled to improve performance and security by setting browser.tabs.remote.autostart to true in about:config. It may be needed to force-enable Electrolysis, although this is generally not recommended and may cause issues.

To check if Electrolysis is enabled, go to about:support and under the "Application Basics" section look for "Multiprocess Windows". If it reports "0/1 (Disabled)", Electrolysis is disabled; if it reports "1/1 (Enabled by user)" it is enabled. Note that the given numbers */* indicate the number of open Firefox windows, e.g. 0/2 meaning non of the two Firefox-windows are using Electrolysis, and 2/2 means it is enabled for both windows.

Disable Pocket

If you don't use the Pocket-service, you may want to disable it by setting extensions.pocket.enabled to false in about:config.

Appearance

Fonts

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.

Note that the above method only affects the Firefox user interface's DPI settings. Web page contents still use a DPI value of 96, which may look ugly or, in the case of high-resolution displays, may be rendered too small to read. A solution is to change layout.css.devPixelsPerPx to system's DPI divided by 96. For example, if your system's DPI is 144, then the value to add is 144/96 = 1.5. Changing layout.css.devPixelsPerPx to 1.5 makes web page contents use a DPI of 144, which looks much better.

See also HiDPI#Firefox for information about HiDPI displays and [2] for calculating the DPI.

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.

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 hash.name, 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 they may need to be created.

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

Change the interface font

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

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css

* {
font-family: "FONT_NAME";
}

Hide button icons

Enables text-only buttons:

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css

.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.

Remove sidebar width restrictions

Unreadable input fields with KDE Breeze Dark theme

If you are using KDE desktop in conjunction with Breeze Dark theme, you might find that some input fields have dark background, which makes text unreadable. A solution to this issue is to use a non-dark GTK theme along with a dark Firefox theme. Similarly, by using a dark Firefox theme your browser will look the way you want (requires Firefox 56 or later).

Unreadable input fields with dark GTK+ themes

When using a dark GTK+ theme, one might encounter Internet pages with unreadable input and text fields (e.g. text input field with white text on white background). This can happen because the site only sets either background or text color, and Firefox takes the other one from the theme.

To prevent Firefox from using theme's colors in web pages one can set browser.display.use_system_colors to false in about:config.

Set the value to the light theme to use for rendering purposes (e.g. Adwaita)

Restart Firefox

Tabs in title bar

To replace the title bar with the tab bar, enable browser.tabs.drawInTitlebar in about:config.

Web content CSS settings

This section deals with the userContent.css file in which you can add custom CSS rules for web content. Changes to this file will take effect once the browser is restarted.

This file can be used for making small fixes or to apply personal styles to frequently visited websites. Custom stylesheets for popular websites are available from sources such as userstyles.org. You can install an add-on such as superUserContent to manage themes. This add-on creates the directory chrome/userContent.css.d and applies changes to the CSS files therein when the page is refreshed.

Enable touchscreen gestures

Make sure dom.w3c_touch_events.enabled is either set to 1 (enabled) or 2 (default, auto-detect).

Add MOZ_USE_XINPUT2 DEFAULT=1 to /etc/security/pam_env.conf and then logout or reboot your system for the changes to take effect.

Mouse click on URL bar's behavior

To make the url bar behaves like in Windows regarding mouse clicks: a single click selects everything, a double click selects a single word until a punctuation sign and a triple click selects everything again, set the following in about:config:

Enable H.264 MSE, amongst other things (This boolean key has to be created!)

Widevine and Netflix/Amazon Video

Widevine is a digital rights management tool that Netflix, Amazon Prime Video, and others use to protect their video content.

The first time you visit a Widevine-enabled page Firefox will display a prompt below the address bar asking for permission to install DRM. Approve this and then wait for the "Downloading" bar to disappear, you are now able to watch videos from Netflix, Amazon Prime Video, or any other Widevine protected site.

Note: Please make sure to check the Play DRM content option under Content-Preference.

Remove full screen warning

Warning about video displayed in full screen mode ("… is now fullscreen") can be disabled by setting full-screen-api.warning.timeout to 0 in about:config.

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.

"I'm Feeling Lucky" mode

Some search engines have a "feeling lucky" feature. For example, Google has "I'm Feeling Lucky", and DuckDuckGo has "I'm Feeling Ducky".

To activate them, search for keyword.url in about:config and modify its value (if any) to the URL of the search engine.

For Google, set it to:

https://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=

For DuckDuckGo, set it to:

https://duckduckgo.com/?q=\

Secure DNS with DNSSEC validator

Adding magnet protocol association

In about:config set network.protocol-handler.expose.magnet to false. In case it does not exist, it needs to be created, right click on a free area and select New > Boolean, input network.protocol-handler.expose.magnet and set it 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 BitTorrent client. This technique can also be used with other protocols: network.protocol-handler.expose.<protocol>.

Note: This will be effective for every application used under a graphic server.

Plugins do not work with latest version

There can be compatibility issues with plugins not working with the latest Firefox version (e.g. Pentadactyl). If possible, try installing the nightly/beta builds available, or temporarily downgrade Firefox.

Disable Add-on Compatibility Checks plugin should take care of spurious compatibility issues when the plugins get disabled, even though they work just fine with the new version.

Jerky or choppy scrolling

Scrolling in Firefox can feel "jerky" or "choppy". A post on MozillaZine gives settings that work on Gentoo, but reportedly work on Arch Linux as well:

Set mousewheel.min_line_scroll_amount to 40

Set general.smoothScroll and general.smoothScroll.pages to false

Set image.mem.min_discard_timeout_ms to something really large such as 2100000000 but no more than 2140000000. Above that number Firefox will not accept your entry and complain with the error code: "The text you entered is not a number."

Note: There is a bug in systemd version 235 that causes /tmp/.X11-unix to disappear from the filesystem when doing this. If you're having trouble, try binding /tmp/.X11-unix read-only instead: --bind-ro=/tmp/.X11-unix

Once your container is booted, run the Xorg binary like so:

# systemd-run -M firefox --setenv=DISPLAY=:0 firefox

Show search matches position in scroll bar

Warning: Not compatible with Firefox Quantum (version 57 and above).

This Chrome-like feature can be added to Firefox via the FindBar Tweak extension.

Disable WebRTC audio post processing

If you are using the PulseAudio module-echo-cancel, you probably don't want Firefox to do additional audio post processing.

To disable audio post processing, change the value of the following preferences to false:

media.getusermedia.aec_enabled (Acoustic Echo Cancellation)

media.getusermedia.agc_enabled (Automatic Gain Control)

media.getusermedia.noise_enabled (Noise suppression)

Fido U2F authentication

Install libu2f-host for the required udev rules to allow Firefox to communicate with the U2F key.

Since version 57, Firefox supports Fido U2F authentication protocol. However, it's disabled by default. To enable it set the following settings to true in about:config.

security.webauth.u2f

security.webauth.webauthn_enable_usbtoken

Note: Firefox does not inplement the entire U2F protocol [3]. Some site might not work correctly

If you're using a Firefox version lower than 57 (e.g. Firefox 52 ESR), U2F isn't supported natively, but there is an extension to add this functionality.