Dec 182008
 

Firefox does a lot of IO to the disk even thou you have lots of spare Ram, due to Sqlite, Bookmarks, History and Cache.

To make Firefox faster is to store the whole profile folder into a Ram Disk.
RamDisk in Linux are called TmpFS. You can also use shared memory folder /dev/shm if you have it in your fstab.

This post in the gentoo forums explains how to do it in Gentoo linux.

I made a similar script to make it work in OSX Leopard.

The Script have 2 parts, Start.sh and Stop.sh
Here are the Scripts:

Start.sh

#!/bin/bash
# Run this script to enable the Ramdisk for Firefox profiles
VolumeName="Mozilla"
 
# Size in MB, make sure is not too low or not too high
SizeInMB=220
 
NumSectors=$((2*1024*SizeInMB))
 
DeviceName=`hdid -nomount ram://$NumSectors`
 
echo $DeviceName
 
diskutil eraseVolume HFS+ RAMDisk $DeviceName
 
# move the current profiles folder
mv Profiles Profiles_ &&
 
# make a symlink to the ramdisk
ln -s /Volumes/RAMDisk ./Profiles &&
 
# then copy it to the ramdisk
/bin/cp -r Profiles_/* Profiles

Stop.sh

#!/bin/bash
cd ~/Library/Cache/Firefox/
 
# clean the cache
rm -rf  Profiles/*/Cache/* &&
 
# will save your modifications back to the DISK
/usr/bin/rsync -av --delete ./Profiles/ ./Profiles_/ &&
 
# sometimes during unmount it will say disk is in use.
# make sure you close firefox before.
umount /Volumes/RAMDisk &&
rm -rf Profiles &&
mv Profiles_ Profiles

You can also use ‘tar’ instead of ‘rsync’. I just love rsync more.

* Warning: The ramdisk contents will be erased after you umount the ramdisk.

Have fun.

Gentoo Linux ROCKS

Update:

To speed up firefox even moreĀ  run these commands:

cd ~/Library/Caches/Firefox/Profiles
 
for i in */*.sqlite; do sqlite3 $i VACUUM;done;
 
cd ~/Library/Application\ Support/Firefox/Profiles
 
for i in */*.sqlite; do sqlite3 $i VACUUM;done;

Switch to our mobile site