[ccache] Theoretical question regarding ccache

Anders Björklund anders at ecsit.se
Sat Apr 29 15:07:44 UTC 2017

Aashaka Shah wrote:

> I recently came across ccache as I have an assignment to think of a novel
> compiler design or related problem, and having a cache for compilers was
> the first thing that came to my mind. I thought of trying it out on
> QuantLib, a financial computation library.

Hi! It would interesting to have some more scientific research on this,
since ccache is a rather pragmatic project. It's "memoization", I think.

> I would like to know
> 1. Why multiple source files cannot take advantage of ccache ( Why other
> types of compilations (multi-file compilation, linking, etc) will silently
> fall back to running the real compiler)

Well, depends on what you mean with "source" exactly. Basically when you
have one source (.c), it would still read a lot of headers (.h) etc...

But when you give the compiler more than one C/C++ source file, it will
compile them one by one anyway. Looks like your build system is broken ?

Do you have an example of the actual files you are trying to compile ?

It would help when trying to understand what you are trying to do here.

> 2. Where in the memory hierarchy(cache, main memory?) does the ccache
> output reside? Does it work according to the default replacement policies
> of the hardware cache?

The ccache files are stored on the filesystem, so in the "secondary" ?
Usually it's stored in RAM and written to disk, unless using a ramdisk.

Using the memcached implementation also offers you other mixed options.
https://en.wikipedia.org/wiki/Memcached (see the dev/memcached branch)


More information about the ccache mailing list