April 12, 2016

Running firefox cache on ram disk

There's a trick to make firefox blazing fast by having the cache running on a ramdisk. Here's how its done in Ubuntu, and this is for OSX.

The key difference is the command used to create the RAM disk. For OSX it's the diskutil. You can most likely create the RAM disk usung tge diskutil GUI tool from. But this simple comman dline will create a disk for you:

$ diskutil erasevolume HFS+ '<volume name>' `hdiutil attach -nomount ram://<disk size in bytes`

The ram disk will be mounted in /Volumes/<volume name>

Next, you'll have to use it in firefox. Enter: about:config in the URL and say yes to you'll be careful question. You'll need two keys, a string and an integer key. The string key must point to where your ram disk is located on your drive, and the integer key must contain the ramdisk size in bytes.

Right click the `preference name` table header and select new > string and type: browser.cache.disk.parent_directory and enter the value: /Volumes/firefox_cache
Now, add a new > integer and type: browser.cache.disk.capacity and enter 1165430 as the size, or whatever you like.


If you'd like to keep your ram disk in between boots, you should add the following line to your .bash_profile, to ensure that the ramdisk is created and cache used by firefox after a reboot.

[ ! -d /Volumes/firefox_cache ] && diskutil erasevolume HFS+ '<volume name>' `hdiutil attach -nomount ram://<disk size in bytes`

No comments: