
Firefox 3 is a significant stride forward in features, but it carries with it an equally significant stride backward in performance. The stats are much better – better memory usage both at startup and over time, faster JavaScript execution, less CPU time – but the browser just felt sluggish, even when it shouldn’t. Thought that your system with a terabyte of RAM and 256 cores could make Firefox soar? It turns out that, for most users, Firefox is actually I/O-bound, in large part because of the switch to SQLite databases.
SQLite is designed to be portable and highly reliable, and it pulls this off with amazing success. However, it does this at the cost of speed. SQLite implements its own journaling system, lock contention procedures, multi-process access, and more. Since SQLite is a portable library, the only way to pull these complex feats off is through standard file I/O. As the volume of data that Firefox stores in SQLite databases grow – and as the number of tabs concurrently trying to access those databases on your system do as well – the time spent by Firefox on secure, hardware-backed I/O grows as well. And since SQLite is so cautious about synchronization, even gobs of RAM and a fast CPU can’t help; the process becomes entirely I/O-bound, particularly at the moments where it should be the most responsive (typing a URL, opening or switching tabs, and the like).
But how attached are you to the last five minutes of your browsing history, really? SQLite’s agonizingly slow access times can destroy performance – and, because of the high volume of writes, it can also destroy sectors on SSDs, USB drives, or other flash media if your profile is on one of these devices. To me, it’s worth accepting a little volatility in the event of a crash for a noticeable and welcome increase in responsiveness.
tmpfs is a virtual, RAM-backed filesystem. It’s lightning-fast, but since it’s RAM-backed, any file written to tmpfs uses precious memory while it’s there, and the entire contents of the virtual partition are lost on shutdown or crash. The good news is that these detriments can be minimized, making tmpfs a viable choice for your profile directory. This document gives some tips on how to mount your Firefox profile in a tmpfs partition while minimizing the downsides of tmpfs.
Continue reading ‘Improve Firefox 3 Speeds with tmpfs’ »