Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 242
peeyush Avatar asked Dec 18 '11 18:12

peeyush


2 Answers

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.

like image 194
Basile Starynkevitch Avatar answered Sep 19 '22 01:09

Basile Starynkevitch


You phrased your question well by asking wrong behavior.

The wrong behavior ccache may have is slowing down your compilation if used incorrectly. ccache has to scan the file to recognize past compilations, so an actual compilation through ccache is slower than without it. Only a cache hit is faster.

ccache is useful when you frequently recompile the same code without modifying it. It will not speed up compilation of new or modified code.

like image 42
Offirmo Avatar answered Sep 22 '22 01:09

Offirmo