[ccache] ccache and gcc triplet

Joel Rosdahl joel at rosdahl.net
Mon Jan 31 13:02:29 MST 2011

On 2011-01-25 08:32, Gilles Espinasse wrote:
> Then I had the issue that the 1 G default size is slightly less than
> what is needed. If you look at the stats after the full distrib build,
> you may see a 'cache size' a bit below the limit and think the size is
> enought. But that may be wrong.

I agree that could be a bit misleading.

> Tracing stats after each packet build, I haven't seen a size bigger
> than 922 MB referenced. Then size decrease to approximately 850 MB due
> old hits purge and increase again with usage.

The reason for the behaviour is that each of the 16 first-level cache
directories are cleaned up individually. When the size of one of them
exceeds max_cache_size/16, files are removed from it until the size is
below 0.8*max_cache_size/16. This means that the cache size (once it
has been filled one time) will be 0.9*max_cache_size on average.

> How do you know that 'max size' is too small? Is-it when you reach
> more than 'max size' x 0.85?

If the max cache size is too small, you get cache misses because of too
aggressive cache cleanup. If the max cache size is too large, you waste
disk space. I don't think there's a good rule of thumb for what the max
cache size should be, since it depends on the circumstances. But if you
have lots of disk, just set it high (or maybe even unlimited).
Otherwise, a good indicator of a too small cache size is if you get
cache misses for things that should have been taken from the cache.

> I just saw yesterday that ccache-3 ubuntu package have an
> update-ccache-symlink that parse /usr/lib/gcc to find installed compiler
> triplet (with some c89/c99 variations).

Yes, made by me. :-)

-- Joel

More information about the ccache mailing list