Comzeradd posted a great article recently on how to speed up firefox by moving your ~/.mozilla folder on a tmpfs mount.
As you probably know, firefox keeps track of everything you visit while you browse the web infinity, then allows you to quick-search that history just by typing in its awesome bar –err, address bar
Unfortunately, after a while the whole thing slows down and gets a bit annoying. So what Comzeradd tried was to move ~/.mozilla (which includes the history database) on a tmpfs mount.
The difference is staggering! Searches are snappy again and even firefox itself feels faster!
Comzeradd offers a script that syncs your tmpfs ~/.mozilla with a folder on your hdd to make sure you won’t lose your data on reboot/shutdown/powerfail.
I took this a step further by creating a firefox wrapper script. After you move your ~/.mozilla folder to a safe place, this script makes sure that your data is always synced between the tmpfs folder and your hdd folder on a fixed interval.
what the script does, in steps:
- check that we don’t have any stale ~/.mozilla folder
- rsync our hdd copy of .mozilla with our tmpfs
- launch a background process that syncs any changes on the tmpfs .mozilla folder back to our hdd copy every one minute (adjustable)
- launch firefox
- when firefox ends, kill background process and sync back to the hdd one last time
To use the script, you’ll first need to mount tmpfs to a folder. On my laptop I have my /var/tmp as tmpfs (useful for gentoo emerges too). To make /var/tmp a tmpfs folder, you need to edit your /etc/fstab file and add the following line:
tmpfsÂ Â Â Â Â Â Â Â Â Â Â /var/tmpÂ Â Â tmpfsÂ size=768M,mode=0777Â Â Â Â Â Â Â Â 0 0
You should adjust the size= option based on the ram you have available.
Then just mount the “partition” with:
and execute the script
chmod +x speedfox
Thats it! This simple process gives firefox a real boost!
If you start speedfox from a terminal, you can see the rsync info at the beginning and after each minute =]
You can get the script here.
Don’t forget to edit it, read the instructions and configure its variables!