[ccache] Radically different ccache performance on Linux vs OSX

Joel Rosdahl joel at rosdahl.net
Tue Sep 14 14:10:54 MDT 2010


On 2010-09-14 21:43, Christopher Tate wrote:
> [...]
> Right now I'm doing some tests around using the new
> CCACHE_SLOPPINESS=file_macro tweak, and initial results are
> promising... but that begs the question of why the results on OSX with
> 2.4 are so poor in general.
> 
> The obvious guess is that there's *something* about our cross-build
> chain and environment that differs from the Linux-hosted versions just
> enough to be upsetting ccache.  Any tips on what I should go looking
> for?

My guess is that some include file in the OSX toolchain contains a
__FILE__ or __TIME__ macro that gets expanded (and kept). This would
explain the cache misses for both ccache 2.4 and 3.0. You should be able
to find the difference by comparing the preprocessor output of two
identical compilation commands. That is, given that you compile with
something like

    gcc ...options... -c file.c -o file.o

you could do this:

    gcc ...options... -E file.c -o file1.i
    gcc ...options... -E file.c -o file2.i
    diff file1.i file2.i

If the culprit is a __FILE__ or __TIME__, you could consider patching
the toolchain, or you could set CCACHE_SLOPPINESS as you mention. (But
setting CCACHE_SLOPPINESS only affects direct mode, so preprocessor mode
will still miss.)

-- Joel


More information about the ccache mailing list