Improving the ccache hit rate

2k Views Asked by At

I am working with distcc and ccache to speed up the compilation of my project.

I noticed that I am not getting any hits when I am building the same code from different directories. I looked up online https://github.com/ccache/ccache/issues/212 and saw that I need to set the hash_dir flag = false. I already have the variable CCACHE_NOHASHDIR=true. Am I missing something? Do I need to set/unset any other variables?

1

There are 1 best solutions below

1
Gerardo Hernandez On

Does your command line contain absolute paths? If so, you need to set CCACHE_BASEDIR to the base directory of your working copy. See How do I make ccache cache compilation when using absolute paths to the compiled files in different directories?.

I wrote ccache quick guide which explains how to debug and avoid cache misses.