Search code examples
performancegcccompilationccache

disadvantages of ccache


I am using ccache for experiments, but I am not quite sure that I should use this. Can anyone explain the situation when ccache can result in wrong behavior. Or should we always use ccache ? Anyone who got that ccache is producing wrong object files or changes in header files are not being considered ?


Solution

  • I practically never have any issues while using ccache. Sometimes (e.g. once a month or even less), I clean entirely its cache with ccache -C.

    I have more issues with complex Makefile-s than with ccache.

    To be short, don't bother, and when you suspect something, just run ccache -C.

    You obviously should avoid ccache when you are benchmarking the compilation time. (You could pass -time or -ftime-report to gcc or g++ in that case).

    Addenda

    I my opinion, ccache should be at least configurable to disable caching for compilation using GCC plugins, because a GCC plugin could do anything (e.g. querying a database or webservice) which is not cachable. See this message.