13

Just started using ccache based on this tutorial and so far I like it. However, caches miss are being extremely slow. Here are my results :

Regular clean build without ccache : 1m40s
First build with ccache : 4m36s
Second build with ccache : 30s

I’m not sure where to start debugging. The performance page (https://ccache.samba.org/performance.html) mentions how complexity of the make file can slow down compilation, but in this context I use Xcode so call of ccache should be relatively quick. I was expecting some performance decrease, but not this much!

There are my current settings using version 3.2.5 :

export CCACHE_MAXSIZE=3G
export CCACHE_HARDLINK=true
export CCACHE_SLOPPINESS=pch_defines,file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches

Note that I do use a pch, if that changes something.

gcamp
  • 14,622
  • 4
  • 54
  • 85
  • Where is your ccache dir? I would guess your ccache dir is on remote (e.g. nfs) and causes the slow performance. – Mine Jun 30 '16 at 05:53
  • It's in my home directory so that's not the issue. – gcamp Jun 30 '16 at 13:33
  • I am experiencing similar symptoms, and the `CCACHE_SLOPPINESS` seems to be a critical factor in my experiments. Running on a clean cache, with PCH enabled and an empty `CCACHE_SLOPPINESS`, my (long) build takes 1h25. If I repeat the same but add `pch_defines,time_macros,include_file_mtime,include_file_ctime` to `CCACHE_SLOPPINESS` I jump to around 1h45 of build time. – Duduche Mar 16 '23 at 10:49

1 Answers1

6

You may run command "ccache -s" to see the statistics.

And from experiments at the end of this ccache bug thread https://github.com/ccache/ccache/issues/54, try reducing the parallel cores compiler used may help, file locking from multiple processes may be the root cause.

Ranger Wu
  • 401
  • 2
  • 6
  • Nothing wrong that I can see in the statistics. Will try to reduce the number of parallel cores and report back! – gcamp Jun 30 '16 at 13:34
  • @gcamp, Were you able to resolve this? Reducing the number of parallel cores doesn't seem to be a good idea with a 3,500 file project. – Vivek Kumar Sep 17 '20 at 13:10