Actually there's a great extension for Firefox to optimize bookmarks database. It's called Vacuum Places 0.2 (https://addons.mozilla.org/en-US/firefox/addon/13824)
SpeedyFox (http://www.crystalidea.com/speedyfox) is a free utility to optimize (vacuum = defrag and compact) every SQLite database used by Firefox. It can also be applied on a custom user folder in case you have several versions of Firefox on your computer (e.g. regular + portable).