Tuesday, September 2, 2008

ccache = much speedier Firefox builds

I just discovered the awesome tool "ccache". I wish I'd known about it long ago -- it drastically speeds up Firefox rebuilds. From its man page, ccache "speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again."

I figured I'd share my ccache setup under Ubuntu Linux, in case anyone else wants to use it. (This is based on Darin Fisher's setup, from his ccache post back in 2004.)

Install ccache:
sudo apt-get install ccache

Add these to ~/.bashrc:
export CCACHE_DIR=/scratch/work/builds/.ccache
export CC="ccache gcc"
export CXX="ccache g++"

(Note that "/scratch/work/builds/.ccache" is just an empty directory on the partition where I intend to build Firefox. You'll probably want to replace that with something else -- or you can remove that line to get the default location, $HOME/.ccache)

Then, source that file (to make sure $CCACHE_DIR is defined) and initialize your cache with a largish maximum size (2 gigs):
source ~/.bashrc
ccache -M 2G
And you're done! The next time you do a "make -f client.mk build", you should see "ccache g++" in place of "g++" in the output, and your .ccache folder should start to grow in size.

I tested ccache's performance by doing an initial build of Firefox trunk (to populate the cache), deleting that build, and then doing a second full build (to make use of the cache). I timed the second build, to see how much the caching helped.

On my work machine, ccache reduced build time from 22 to 11 minutes. And on my home machine, ccache reduced build time from 12 to 4 minutes! (Compare that to multi-hour build times on Windows. :) )

Friday, March 14, 2008

Impressive Spam

I just received this impressive piece of spam...

Yes, that's ASCII art.

Spam-detectors are going to have to start doing multiple passes of text --> blurred image --> text, in order to catch stuff like this...