# Why is Firefox so slow ?



## Abhid (Sep 29, 2021)

I recently upgraded to 13.0-RELEASE-p3. I have a 64-bit Dell Inspiron laptop, running on an AMD E2 7th gen processor and 4 GB DDR4 RAM.

My Firefox version was also updated to 91.0. But all pages load very slowly. Ordinary news and e-commerce sites take upto a minute to load. The same pages load within 4 or 5 seconds on my Windows laptop, which is connected to the same Wi-Fi network as the FreeBSD laptop is.

Do I have to change some settings to enable Firefox to run normally ? Is my hardware configuration inadequate ?


----------



## jbo (Sep 29, 2021)

I have only recently started using FreeBSD as a desktop OS but I am not experiencing any performance issues with FireFox on any of my machines.

You could fire up the developer tools and look at the corresponding tab reporting loading times/speeds (the waterfall thing). This could give some insights as to what is causing the hold-ups (i.e. networking fetching, rendering, script stuff, ...).


----------



## teo (Sep 29, 2021)

Abhid said:


> I recently upgraded to 13.0-RELEASE-p3. I have a 64-bit Dell Inspiron laptop, running on an AMD E2 7th gen processor and 4 GB DDR4 RAM.
> 
> My Firefox version was also updated to 91.0. But all pages load very slowly. Ordinary news and e-commerce sites take upto a minute to load. The same pages load within 4 or 5 seconds on my Windows laptop, which is connected to the same Wi-Fi network as the FreeBSD laptop is.
> 
> Do I have to change some settings to enable Firefox to run normally ? Is my hardware configuration inadequate ?


This is due to having a system with quarterly software support, when it is always advisable to have a system with the latest, healthy to avoid vulnerabilities or system failures when updating or precompiling a port, today the Firefox browser is on version 92.


----------



## SirDice (Sep 29, 2021)

Check if IPv6 is enabled and working properly. If IPv6 is enabled but not working correctly you get various timeouts as the requests will be made on IPv6 first before it falls back to IPv4. That causes a number of annoying delays when browsing.


----------



## dd_ff_bb (Sep 29, 2021)

teo said:


> today the Firefox browser is on version 92



Im on 13 quarterly and running Firefox 92



Abhid said:


> But all pages load very slowly



Last time it happened to me i gave same ip to 2 computers ( 3 days ago  )


----------



## Argentum (Sep 29, 2021)

Abhid said:


> I recently upgraded to 13.0-RELEASE-p3. I have a 64-bit Dell Inspiron laptop, running on an AMD E2 7th gen processor and 4 GB DDR4 RAM.
> 
> My Firefox version was also updated to 91.0. But all pages load very slowly. Ordinary news and e-commerce sites take upto a minute to load. The same pages load within 4 or 5 seconds on my Windows laptop, which is connected to the same Wi-Fi network as the FreeBSD laptop is.
> 
> Do I have to change some settings to enable Firefox to run normally ? Is my hardware configuration inadequate ?


It is hard to tell, given only this information. See `top` in a terminal window when it is loading the page. Also try www/chromium with the same page. Is it only Firefox slow or Chromium also? IP misconfiguration has been suggested here. See if your memory is not full.
Personally, I am a long time desktop user of FreeBSD, I have Firefox, Chromium and Konqueror browsers installed. All of these feel good.


----------



## Vull (Sep 29, 2021)

I'm also on quarterly. FreeBSD 13.0-RELEASE-p4 and Firefox 92.0.1. Everything seems to be running briskly. Recently I was on Firefox 91, and thought it might have been a somewhat flaky version. Please try running `freebsd-update` and `pkg update && pkg upgrade` again, and see if your problems still persist.

Edited to add: I was assuming you're using packages when I wrote the above. If you're mixing ports and packages, please consider switching from quarterly to latest in order to better synchronize packages with ports.


----------



## grahamperrin@ (Sep 30, 2021)

This is probably not an issue with Firefox.

You might find a wired connection *much* faster.



Abhid said:


> Wi-Fi



Without knowing the hardware: I should assume that it's driven slowly by FreeBSD.

Improved support for Wi-Fi is on the roadmap.









						Technology Roadmap
					

https://freebsdfoundation.org/blog/technology-roadmap/  Enjoy.




					forums.freebsd.org
				





If you still suspect an issue with Firefox, please share _More Troubleshooting Information_; copy text (not raw data) and paste here as code. Thanks.


----------



## Abhid (Oct 1, 2021)

I thank all of you for your valuable suggestions. I followed all of them and here is what I found:

My Firefox has enabled IPv6 by default.
Using the developer tools of Firefox, the pyramid keeps on extending for many seconds (especially while loading DoM components).
However, the top command may indicate some heavy usage by Firefox. I loaded Facebook.com and Firefox's consumption fluctuates between 84%, 34% and 10% before settling down to < 1%. This takes a very long time. I have only 2 tabs open currently.
So now I am executing freebsd-update and pkg update && pkg upgrade. The packages are downloading at 50 to 100 KBps. So this may be a problem with FreeBSD.
I will definitely test the system after the upgrade and inform here.


----------



## drhowarddrfine (Oct 1, 2021)

Abhid said:


> Using the developer tools of Firefox, the pyramid keeps on extending for many seconds (especially while loading DoM components).


This is an issue with Facebook, not Firefox or FreeBSD. Facebook loads tons of crap when you visit their web pages.




Abhid said:


> the top command may indicate some heavy usage by Firefox. I loaded Facebook.com


Same thing. 



Abhid said:


> The packages are downloading at 50 to 100 KBps. So this may be a problem with FreeBSD.


No. Unless you are saying it's a configuration problem with your network settings. 

I have a 32-bit Dell Inspiron that's obviously very old and I use it for backups. It has no issues with updating packages and I check it and do that every day.


----------



## Abhid (Oct 2, 2021)

Hello all. After updating and upgrading my FreeBSD, I can report the following:

Firefox has been updated to version 93. There has indeed been a marked improvement in loading of "heavy" pages like Facebook, LinkedIn and some news sites etc. Instead of 1+ minute earlier, they now load in about 15 seconds.
I have not changes any configurations of my Wi-Fi router. By the way I forgot to mention that it also serves 2 TVs running on Amazon Firestick simultaneously and quite smoothly.
It seems after the upgrade, something's changed for the better. Is it Firefox or FreeBSD itself, I cannot say.

I'll keep monitoring the speed at random times during the day.



drhowarddrfine said:


> No. Unless you are saying it's a configuration problem with your network settings.


drhowarddrfine, I doubt it because my Wi-Fi router also serves other devices like TVs and a Windows laptop, in which I seldom notice a slow performance. Yes, sometimes it disconnects but that's a rare occurrence during any day.


----------



## Abhid (Oct 4, 2021)

*Update after 2 days*: Well, so far so good. Most "heavy" sites like LinkedIn, Facebook and e-commerce sites load within approximately 10 seconds on Firefox. I also tried to simultaneously load any 2 of these sites on 2 tabs. The result is the same.

PS: I also tried WebKitGtk browser. I was surprised that it was a couple of notches faster than Firefox. So, could the speed difference be due to the cache and cookies that have accumulated in Firefox over time ?


----------



## D-FENS (Oct 4, 2021)

Quite often the reason for slow browsing can be DNS issues. Recently they changed Firefox to automatically use encrypted DNS and bypass the system's DNS facilities, which cannot have made it quicker.
You could do the following test:

activate a local DNS cache with unbound, as described here: local-unbound(8)



> To use a    locally    running    *Unbound*    for resolving put
> 
> nameserver    127.0.0.1
> 
> into /etc/resolv.conf


(and remember to comment out the other nameservers)
Then:

```
sysrc local_unbound_enable=YES
service local_unbound start
```

Configure Firefox to NOT use its own DNS machinery: *Edit* >> *Settings* >> (scroll to the bottom) *Network Settings* >> (at the bottom of the dialog) UNCHECK "*Allow DNS over HTTPS*".
Optionally, you can use your local DNS cache to hard-ban a bunch of annoying ad-servers that make your web browsing slow. For example you could download this file and include it in your unbound configuration - it will ban thousands of ad domains automatically: https://raw.githubusercontent.com/notracking/hosts-blocklists/master/unbound/unbound.blacklist.conf (Source: https://github.com/notracking/hosts-blocklists )
Please do report if the DNS tweaks help speed up browsing.

P.S. You can also do a quick test and use another browser (like www/chromium) and also a text-based browser like www/lynx and compare the performance with Firefox.


----------



## grahamperrin@ (Oct 5, 2021)

Abhid said:


> … could the speed difference be due to the cache and cookies that have accumulated in Firefox over time ?



about:profiles
create a new profile
launch the profile in a new browser
test


----------



## bu_mi (Oct 5, 2021)

In case you are behind a router, then may be you could update its firmware, reset it to factory settings and reconfigure it. You could disable ipv6 on your LAN (by disabling dhcp6 on your router) and see if that speeds up loading times.


----------



## Vull (Oct 5, 2021)

Abhid said:


> *Update after 2 days*: Well, so far so good. Most "heavy" sites like LinkedIn, Facebook and e-commerce sites load within approximately 10 seconds on Firefox. I also tried to simultaneously load any 2 of these sites on 2 tabs. The result is the same.
> 
> PS: I also tried WebKitGtk browser. I was surprised that it was a couple of notches faster than Firefox. So, could the speed difference be due to the cache and cookies that have accumulated in Firefox over time ?



> Menu: History > Select: Clear Recent History... >


----------



## Abhid (Oct 7, 2021)

roccobaroccoSC said:


> Quite often the reason for slow browsing can be DNS issues. Recently they changed Firefox to automatically use encrypted DNS and bypass the system's DNS facilities, which cannot have made it quicker.
> You could do the following test:
> 
> activate a local DNS cache with unbound, as described here: local-unbound(8)
> ...


As Vull suggested, I cleared all my cache and cookies and noticed a jump of a few seconds in loading times. Facebook loaded in 5 seconds, and LinkedIn took about 10 seconds.

I did your steps. Firstly, the DNS settings were already disabled in Firefox as shown in the screenshot below:



Then I activated a local DNS cache with unbound according to the steps you mentioned. With these steps, there was no noticeable increase in loading speed as when I got after clearing the cache and cookies.

grahamperrin, I created a new profile as you suggested, but again I did not see any improvement over and above I had after clearing the cache and cookies. In fact it was noticeable much slower. This did not have the UserAgent plugin at all. Normally I use this to spoof ordinary sites, disguised as Chrome running on Windows (or Opera on Mac) etc. Otherwise, they often don't work saying that, "This browser isn't recognized," or "We detected some suspicious activity".

bu_mi, I haven't tried your suggestion yet for fear of disrupting other devices connected to it.

*Summary so far:* Overall, the _biggest change_ came on Monday, 4th October after updating and upgrading FreeBSD. FireFox also got upgraded to version 93 from 91 earlier. Today, after clearing the cache and cookies also there was some slight uptick in some sites. Activating a local DNS cache with unbound did not bring about a noticeable change from what I already did.


----------



## D-FENS (Oct 7, 2021)

Abhid said:


> *Summary so far:* Overall, the _biggest change_ came on Monday, 4th October after updating and upgrading FreeBSD. FireFox also got upgraded to version 93 from 91 earlier. Today, after clearing the cache and cookies also there was some slight uptick in some sites. Activating a local DNS cache with unbound did not bring about a noticeable change from what I already did.


It looks like DNS was not the cause of your issues. Just to be on the safe side, post the output of this command: `drill www.facebook.com`. The command will show how fast the DNS query was executed. Then you can try with `drill @8.8.8.8 www.facebook.com`, which will use Google's DNS server instead of your local DNS cache. And as a third test you can replace the "8.8.8.8" with the IP address of your LAN's DNS - that's probably your router or whatever your provider sets for you.
If the times shown are below 50-100 ms I think it's acceptable. Of course, 20-30 ms would be snappier. And the local DNS should almost always show "0 ms" - it's fast because it does not go over the network.

Another idea - maybe it comes from your browser. Have you installed any add-ons? I would disable all extensions and all add-ons and try with a pure browser. You can even try and create a completely new profile (your profile is stored in ~/.mozilla/firefox). Move the profile and let Firefox create a new one from scratch. This will initialize your browser with factory settings.

Also, try another browser like Chromium and compare the speeds.


----------



## grahamperrin@ (Oct 7, 2021)

Thank you,



Abhid said:


> … I created a new profile as you suggested, … slower. …



Probably because a new profile has nothing cached. For how long did you test?


----------



## Argentum (Oct 8, 2021)

roccobaroccoSC said:


> Also, try another browser like Chromium and compare the speeds.


That is what I recommended also - *try with Chromium* and see if the issue persists. 
Then we know at least, is it browser issue or some other issue in the system or with connection.


----------

