Solving the Slow and laggy Firefox problem


This tutorial was created pre-Quantum (FF57). Some commands might still help, but most won't. Consider this tutorial outdated and obsolete!


For some, and at least for me, Firefox is unusable with stock setting, even with no add-ons installed at all.

Here are some steps that help in getting it faster.

All steps are done in about:config
Handle with care! I am not responsible for problems occuring from typo's and nuked Firefox profiles :wink:

Telling Firefox to cache to RAM instead of disk-only:

  • Set browser.cache.memory.enable to "true"
  • create a new Integer entry: browser.cache.memory.capacity and set it to "-1" (Firefox determines the available RAM and uses it accordingly; it is also possible to set a fixed amount in kilobytes)
  • Set browser.cache.use_new_backend to "1" (Integer)
  • optional: set browser.cache.disk.enable to "false" to completely deactivate the disk cache (it will load all sites completely fresh after every restart of Firefox)

Optimizing Internet Access

Those steps can also be done with the help of an add-on: Speed Tweaks (SpeedyFox)

  • Set network.http.pipelining to "true"
  • Set network.http.pipelining.aggressive to "true"
  • Set network.http.pipelining.reschedule-on-timeout to "true"
  • Set network.dns.disablePrefetch to "true"
  • Set network.prefetch-next to "false"
  • optional: Set network.http.pipelining.ssl and network.http.proxy.pipelining to "true"

Optimize hardware usage

  • Hardware-acceleration is a big performance-gain and it seems to be enabled by default now. You can check it in about:support - if the graphic-section there mentions "Compositing OpenGL" it is active. If it is "Compositing Basic" you can activate it by setting layers.acceleration.force-enabled to "true" ( :exclamation: Might cause graphic issues on some chips, like Intel Atom's)
  • Multithreading support can be forced on if not active by default. Check in about:support if Multiprocess Windows is 1 or higher. If not, add browser.tabs.remote.force-enable (boolean) and set it to "true" (:exclamation: If you have stutters or other performance issues caused by that option, one of your add-on's is not compatible with multithreading. Most add-ons are compatible though. One can check compatibility with this add-on)

I have not set the optional entry's and finally I can use Firefox again without it lagging after 30 minutes. RAM usage is still less than Chromium-based browsers.

18 Likes

Thanks for sharing! Definitely trying this. Firefox runs like a dog on my NUC. Chromium runs fine, but the tooltip bug drives me nuts!

1 Like

Added Hardware-Optimization

I had to disable layers.acceleration.force-enabled again because it was causing parts of the screen to flicker. Apparently, Firefox disables hardware acceleration by default on hardware that it knows to be buggy. That's why the force-enable of it is a bad idea.

Which desktop environment, graphic card and driver did you have issues with?

I actually checked with several AMD chips with Mesa 12 to 17, as well as with 3 Intel chips with mesa 12 to 17 on KDE with OpenGL 3.1 compositor rendering and there were no such issues with force enabling it there. On my main machine, it seems to be activated by default.

KDE with openGL 2.0 and 3.1. The most prominent example is that the address bar flickers a few times while I'm typing an address or search terms into it.

which graphic chip?

Antialiasing/tear free setting? Qt Graphic system nativ or raster? Scaling method? Will check at home, but such an issue never occured on my systems.

The graphics chip is Intel Atom Processor Z36xxx/Z37xxx Series. Tearing prevention set to automatic. Scaling method accurate. QT native.

I believe the hardware acceleration is disabled by default on my machine because Mozilla knows that Firefox has issues with OpenGL on my GPU.

One more suggestion: put your entire Firefox cache in RAM. Just create a new string in about:config: browser.cache.disk.parent_directory=/tmp/firefox. For that to work, browser.cache.disk.enable must obviously be set to true.
It's similar to @BS86's suggestion, but you can leave disk cache enabled.
You can use that together with profile-sync-daemon that also copies the entire profile into tmpfs.

Before you do that, make sure your add-ons are MT compatible. Mozilla provides a special add-on for that. If add-ons are not compatible, you might see some weird behaviour, and in the worst case, worse performance than before.

I have set it to "only when cheap" and the option "only for visible windows".

Yeah, I guess that is the dealbreaker here - Atom's are always a bit special.

Yes, but it will have the same problems like disk cache disabled, but it will only trigger when the machine is rebooted, not at Firefox restart. (I am talking about the complete reloading of all content - that's why I marked it as optional)

do you have a link to that? From what I read, Firefox is intended to do that on its own, but most add-ons do actually run pretty well with MT, although they are not flagged as "compatible".

No but its name is something like "compatibility checker". Here, it actually detected an incompatible extension that was slowing down everything. But you're right in that it should normally not be needed, but it doesn't hurt adding it.

Could not find it, but added a warning in OP

edit:found it now https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/

@anon11646911 For enabling hardware acceleration also read below URL

http://en.librehat.com/blog/force-enable-hardware-acceleration-in-firefox-on-linux/

May be we need to set more variables in addition to what @BS86 suggested

To enable multiprocess you need to do the following
Search for browser.tabs.remote.autostart in about:config and set all variables to true.
No need to force it since firefox48

Also read https://support.ant.com/hc/en-us/articles/115000513446-Firefox-51-Multi-Process

1 Like

THAT 'autostart' actually does not work. The story is that it does but it does not always work.
I.p., if there is any addon that is supposed to be non-compatible with multi-process it will not allow/enable multiprocess.
That's why
browser.tabs.remote.force-enable true
exists. E.g.,
AdBlocker Ultimate
The Camelizer - Price Tracker
Clear Fields
Advertising Cookie Opt-out
extensions are all listed as incompatible with MP but I have yet to see how.

Thanks for the list!
I seem to have lost mine(at least temporarily) and this fits just fine. :slight_smile:

[quote="BS86, post:1, topic:20468"]
RAM usage is still less than Chromium-based browsers.
[/quote]You must not have a lot of tabs open.

That means "autostart" is safe approach. Till today i thought i have multiprocess firefox running.:innocent:

1 Like

[quote="rahulprabhakar, post:17, topic:20468, full:true"]
That means "autostart" is safe approach.[/quote] Yes it is. It S/B on by default ...

[quote="rahulprabhakar, post:17, topic:20468, full:true"]Till today i thought i have multiprocess firefox running.[/quote]Yes I had that too back with Ffx-48-beta. It took me a while to realize they do not force multiprocess even on the -beta builds(which I think is odd). The browser.tabs.remote.force-enable true is the only way I know of to test all installed extensions for multiprocess compatibility. One also must use the Compatibility Reporter of course.
I've tested the extensions with & without MP on and, so far at least, have not found any difference with any of the extensions, whether marked as compatible or not compatible. Same issues exist either way, if there are any.
I'm not certain about the Opt Out extension yet. ...that will take some time.

Good Luck & ...
Have fun!

[quote="BS86, post:1, topic:20468"]
Telling Firefox to cache to RAM instead of disk-only:
[/quote]I used the tips. Pretty much the same as have used before, IIRC.
I still have same issue as have had with Ffx ...for years:
Press [back|foward] button to load the previous page and Firefox goes into some zone where it just sits there and has a conversation with itself:
OMG! $USER WANTS TO SEE THE PREVIOUSLY DISPLAYED PAGE. OMG! WHAT DO I DO NOW? OMG! FIND THE CACHE! OMG! I FOUND THE CACHE! OMG! IS IT IN THE CACHE? OMG! OF COURSE IT IS IN THE CACHE! OMG! LOAD THE CACHED PAGE! OMG! NOW RENDER IT! OMG! HOW DO I DO THAT? OMG! USE THE PREVIOUS RENDERING THAT IS IN THE FSCKING CACHE? OMG! YES!
...or something along that line of absolutely ridiculous conversation with itself.
THEN the page finally loads. It, on this system*, currently, takes no less than 3 seconds and normally/usually longer to go forward or backwards. I won't even discuss what it was like on the AMD dual core, dual CPUs at 2.6GHz other than to say: painful.
Itsa friggin joke. Phoenix was never like that. Chrome is not like that. Chromium is not like that. AFAIK, it is only Firefox and some friends(derivatives) that do that stupid, irritating, time-consuming nonsense.
[Sorry if it seems like a rant but trying to put extra emphasis on the issue. :sob:]

:question: Do you know of any other tweaks to get Ffx to load & render properly and faster?

...
* OS: Manjaro 17.0 Gellivara; Kernel: 4.10.8-1-MANJARO x86_64;
CPU(s)~2 Quad core Intel Xeon X5687s (-HT-MCP-SMP-); Mem~2901.0/24104.9MB; NUMA~2 nodes; Network~2x Intel 82576 Gb; HDD~4961.0GB(17.9% used); GPU~GeForce GTX 1060 6GB; Resolution~3840x2160; GLX~4.5.0 NVIDIA; GP106 ~375.39; DE~KDE 5.32.0 / Plasma 5.9.4; WM~KWin; *.

I have a weird problem now - Youtube videos just refuse to play.

After recent Manjaro Update for 2017-04-02. Could mesa be the cause or hardware acceleration or multiprocessing. See attached snapshot below

Forum kindly sponsored by