ccache == more Speed?

Many people, especially around gentoo linux, do think that ccache is a must-have, reducing compile time pretty much. But is that really true? How much does it really help?

Let’s nail it down with some facts:
ccache parses the compiler call to make sure it’s a single compile as it doesn’t work with linking or multi-source builds (for you nerds out there, I intentionally left out -fwhole-program). As soon as ccache is sure it’s compiling one file, the compiler gets kicked off for preprocessing and the result is saved to a temp. place. This result is being hashed with md4 and then being compared to what we have on disk. If the md4 sum is found, the compiled result is delivered back. Otherwise the compiler gets some work to do.

So our big guys here are preprocessing, hashing and copying files around. No matter if we do have a hit or miss.

To add some numbers for you: As I was debugging some ebuilds and building the same packages over and over (and over) again, I had a hit rate of about 35% at the ccache cache. To be honest, this isn’t much at all. Now looking at hashing itself, we also do have a high cpu load just as if we were compiling. And thanks to some I/O we do not really get a speed benefit.

If I think back of what kind of troubles I had been fighting with ccache, I am ditching it completely in my make.conf.

Share

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.