Ccache disadvantages

I use ccache for experimentation, but I'm not quite sure what I should use this. Can someone explain a situation where ccache can lead to abnormal behavior. Or should we always use ccache? Anyone who got this ccache creates the wrong object files or changes to the header files are not considered?

+4
source share
3 answers

I have practically no problems using ccache . Sometimes (for example, once a month or even less) I completely clear its cache using ccache -C .

I have more problems with complex Makefiles than with ccache .

In short, don't worry, and when you suspect something, just run ccache -C .

Obviously, you should avoid ccache when you are compiling compile time. (You can pass -time or -ftime-report to gcc or g++ in this case).

Addenda

I believe that ccache should at least be configured to disable caching for compilation using GCC plugins, as the GCC plugin could do something (e.g. query a database or a web service) that is not cached. See this post .

+8
source

You correctly formulated your question by asking the wrong behavior .

Incorrect ccache behavior can slow down your compilation if used improperly. ccache must scan the file to recognize past compilations, so the actual compilation of ccache is slower than without it. Only cache acceleration is faster.

ccache is useful when you often recompile the same code without changing it. This will not speed up the compilation of new or changed code.

+3
source

I had problems compiling SCons via ccache (symlink method).

Environment settings

It turned out that ccache requires that the $ HOME variable be set in the environment, while SCons did not set it by default (SCons has a policy that allows isolating assemblies from the environment as much as possible by default).

I'm not quite sure if this will be considered a problem with ccache or just interaction with SCons. Besides this quirk, I have never had a problem with ccache.

SSD wear

I was in the habit of associating ~ / .ccache with tmpfs to avoid unnecessary use of my SSDs. Obviously, this is not a problem with ccache, because without it everything will be even worse. (Just something to keep in mind)

+3
source

Source: https://habr.com/ru/post/1386944/


All Articles