Monday, October 23, 2006

Improving compile speeds on Linux

I rediscovered an old friend today, ccache. It is a compiler cache written by Andrew Tridgell of SAMBA fame.

It enhances (re-)compilation by maintaining a cache of previously built object files. This comes in very handy if you ever do:
make clean; make
Or as I do, switch between development lines or versions of a program to perform a test and then have to do a full recompile each time.

After installing it on Fedora:
# yum install ccache
I did:
# ln -s $(which ccache) /usr/local/bin/gcc
# ln -s $(which ccache) /usr/local/bin/g++
# ln -s $(which ccache) /usr/local/bin/cc
so that it would automatically be invoked in place of the non-caching compiler.

No comments: