Tweak firefox on Linux
Note: At this point mainly a TL;DR for [1] and [2] given a system with a solid state drive (SSD) and plenty of random access memory (RAM). To be extended.
Firefox RAM cache
To make firefox cache exclusively in memory, add the following firefox settings
(either from about:config
or user.js
) [^ram][1]
[^ram]: Note: these settings are for a 32GB RAM system, replace the 32.0 as appropriate.
browser.cache.disk.enable = false
browser.cache.memory.enable = true
browser.cache.memory.capacity = 41297 - (41606 / (1 + ((32.0 / 1.16) ^ 0.75)))
Firefox RAM profile
If you are questioning, “can we go the extra mile?”, the answer is yes. We can do the same not only for cache, but for the entire firefox profile.
Without going into the details (see https://wiki.archlinux.org/title/Profile-sync-daemon for those) on an Arch Linux system —after closing firefox— we do so as follows:
sudo pacman -S profile-sync-daemon
systemctl --user enable --now psd
psd preview
Having both enabled and started (--now
) the service, we see that the service
and timer are now active.
rofile-sync-daemon v6.48
systemd service: active
resync-timer: active
sync on sleep: disabled
use overlayfs: disabled
However, as is inherent to all, there is a trade-off involved. We traded
persistence for speed that came with increased volatility. That is, we now lose
our browser state should firefox or our system crash. Its remains either swept
away for space reclaimed or out in the ether as voltage seeps out of our RAM.
The good news is that psd
already mitigates this for the most part by
periodically syncing the profile (now in RAM) to disk.