ccache

ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. [source]

 logfile

 
            building zsh-4.2.4 without ccache

            real    3m5.475s
            user    2m49.827s
            sys     0m14.502s
            --------------------------------------
            rebuilding zsh-4.2.4 without ccache

            real    2m59.200s
            user    2m47.119s
            sys     0m11.121s
            --------------------------------------
            rebuilding zsh-4.2.4 with ccache (1/2)

            real    0m27.413s
            user    0m17.754s
            sys     0m6.685s
            --------------------------------------
            rebuilding zsh-4.2.4 with ccache (2/2)

            real    0m24.800s
            user    0m17.833s
            sys     0m6.530s
      

 file

 comment

As you can see the result is quite impressive, with the help of ccache you can reduce the compile time to a sixth part. But this optimization is only available on iterative builds like nightly builds.

 using it on crux

I just put the following lines in /etc/pkgmk.conf.

          if [ -d /usr/lib/ccache ]; then
            export PATH=/usr/lib/ccache:$PATH
          fi