One of the things that I’ve found that I’ve had to do with firefox is occasionally blow away the .mozilla directory, and start fresh, because over time, it just gets slower and slower, eating more and more resources - like it’s retaining information about every web page you’ve ever visited.
The other thing I did recently was start using separate firefox profiles for different things, and I created zfs datasets for each so that it’s easier to revert a profile when it gets too bogged down. That seems to have helped, but firefox is still very much not performant. My experience with chrome isn’t much better though. I’m not sure that it’s as much of a memory hog, but it gets pretty slow too - especially if you have a lot of tabs and/or windows.
I mounted my firefox profile datasets in ~/.config/firefox_profiles, and created this script:
if [ $# -ne 1 ]; then
echo "Missing profile argument"
/usr/local/bin/firefox --no-remote --profile ~/.config/firefox_profiles/$1
which I then call with the name of the profile I want to use. I’ve done something similar with chrome.
I don’t know that this really improves the memory usage overall, but it’s definitely helped keep the CPU usage down.