One of the most likely cause of high CPU usage by Firefox is fragmentation of its database files (.sqlite files). If you have a habit of bookmarking and deleting unused bookmarks, places.sqlite, where bookmarks are stored, would be fragmented. You can shrink this file using sqlite3.
If you are using Windows OS, downlod this file from http://www.sqlite.org/download.html and extract the executable to C:\Windows folder (or any other folder included in the PATH variable).
If you are using Ubuntu, install sqlite3 using the following command
sudo apt-get install sqlite3
To shrink the database file, run the following command after replacing <your profile>
sqlite3 "%APPDATA%\Mozilla\Firefox\Profiles\<your profile
sqlite3 $HOME/.mozilla/firefox/<your profile
It is recommended that you take a backup of the sqlite file you are about to shrink.
If you wish to shrink all sqlite files, cd to the profile directory and run this command:
for %i in (*.sqlite) do @echo VACUUM; | sqlite3 %i
for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done
If shrinking the file doesn't solve the problem:
- Take a backup of places.sqlite
- Start Firefox and export all your bookmarks
- Stop Firefox
- Delete places.sqlite file
- Start Firefox and import your bookmarks