ITK/Release 4/Wrapping/ccache
Using CCache for WrapITK
Using CCache[1] to build WrapITK can improve the build times considerably. For all unix systems (including MacOS X), ccache is enabled by creating symbolic links to the g++/gcc compiler:
ln -s /usr/bin/ccache /usr/local/bin/g++ ln -s /usr/bin/ccache /usr/local/bin/gcc
Alternatively, on MacOS X, Install ccache with Macports. The Macports installation would automatically create the symbolic links to g++/gcc compilers and put them in the directory /opt/local/libexec/ccache. The only remaining thing then is to add this directory to the PATH variable (alternatively you can add it to the .bash_profile or .profile in home directory)
$ sudo port install ccache $ export PATH= /opt/local/libexec/ccache:$PATH
All the subsequent builds of WrapITK would use ccache and we can see a speedup of as much as 40 minutes for repeated invocations. For example, following lists the results for building WrapITK with & without ccache (for 8-core Quad-Core Intel Xeon with Mac OSX Snow Leopard):
Without cache:
time make -j 12 real 46m58.307s user 41m49.829s sys 4m22.580s
Repeated invocation:
make clean time make -j 12 real 44m3.667s user 39m29.606s sys 3m49.870s
On enabling ccache, the build times reduce considerably as noted below:
With cache:
time make -j 12 real 45m44.488s user 40m3.881s sys 4m25.381s ccache -s cache hit (direct) 19 cache hit (preprocessed) 1 cache miss 2658 called for link 396 compile failed 22 preprocessor error 12 no input file 21 files in cache 5307 cache size 593.9 Mbytes max cache size 1.0 Gbytes
Repeated invocation:
make clean time make -j 12
real 2m48.801s user 1m28.743s sys 0m40.986s
ccache -s cache hit (direct) 2435 cache hit (preprocessed) 0 cache miss 0 called for link 152 files in cache 5307 cache size 593.9 Mbytes max cache size 1.0 Gbytes