Here’s a handy one-liner to tune a bit your Firefox:
for file in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $file 'VACUUM;';done
What this does ie optimize every sqlite database in your account’s profiles. You can even add this line to a script to start on boot or by cron. Worth noting that Firefox should probably not run while you do this.