Speed Up Mozilla Firefox by optimizing the database

We have seen how to speed up Google Chrome by optimizing the profile database on Linux, but a similar procedure works also for Mozilla Firefox.

As for Google Chrome, we first need sqlite3.
For Ubuntu and Debian derivates install it with the following command from the terminal:
sudo apt-get install sqlite3
For Gentoo the command is the following:
sudo emerge sqlite3
On other distributions use the relative package manager.
Once installed, close Mozilla Firefox and from a terminal give the following commands:
find $HOME/.mozilla/ \( -name "*.sqlite" \) -exec sqlite3 {} "vacuum" \;
And now you can open Mozilla Firefox again.