Joe Williams home
In hopes of squeezing a bit more performance out of firefox and thunderbird I decided to compile them from source with some gcc optimizations. Here's a general outline of what I had to do:
  1. Install needed build utilities: apt-get install autotools-dev fakeroot dh-make build-essential
  2. Make a directory for the source: mkdir src; cd src
  3. Download source: apt-get source PACKAGENAME
  4. Download build dependencies: apt-get build-dep PACKAGENAME
  5. Change into the directory create: cd NAME
  6. Edit 'debian/rules', change 'OPTFLAGS' to something better suited for your machine. I used: -O3 -march=prescott -pipe -ftracer -fomit-frame-pointer -freorder-blocks -fno-reorder-functions -funroll-loops -D_FORTIFY_SOURCE=2 -fweb -fno-strict-aliasing which should help speed things up for a Core Duo. If you have a different CPU some of these options may be different. D_FORTIFY_SOURCE will help against buffer overflows by being more strict on copies to buffers. See here.
  7. I also add export MOZ_MAKE_FLAGS='-j3' to the rules to help compile in parallel since I am using a dual core CPU.
  8. Build it: dpkg-buildpackage -rfakeroot -uc -b
  9. ... sit and wait, depending on the package this can take a long time
Something like that should work for most packages. Comment if you have any additional info or questions. Check out this and this for more info on gcc optimization.
Fork me on GitHub