ccache

Ccache is a solution to try and speed up incremental builds of C/C++ code by figuring a smart way to “cache” on disc object files generated by a C/C++ compiler.

ccache simulates the C preprocessor, calculates an MD5 hash and if the hash has not changed then we can just copy the object file from the cache rather than re-invoking the compiler.

ccache usually consumes a fair bit of disc space. I wouldn’t take it for granted that ccache always works - your mileage may vary depending on what version someone is running.

For more information:

Ccache — Compiler cache

You can see the state of ccache with the -s flag which gives much more clarity as to what it is doing:

Eliots-MacBook-Pro-2:COL eliotmuir$ ccache -s cache directory /Users/eliotmuir/.ccache primary config /Users/eliotmuir/.ccache/ccache.conf secondary config (readonly) /usr/local/Cellar/ccache/3.7.4/etc/ccache.conf stats updated Wed Sep 1 11:35:53 2021 stats zeroed Sat Apr 3 17:41:13 2021 cache hit (direct) 110141 cache hit (preprocessed) 4424 cache miss 22688 cache hit rate 83.47 % called for link 5700 called for preprocessing 13 multiple source files 3 compiler produced empty output 2 compile failed 996 preprocessor error 985 bad compiler arguments 1 autoconf compile/link 42 no input file 5 cleanups performed 0 files in cache 55462 cache size 2.5 GB max cache size 5.0 GB