ccache cache miss很慢的编译速度很慢

gca*_*amp 9 c++ performance xcode ccache ios

刚开始使用基于本教程的 ccache ,到目前为止我喜欢它.然而,缓存错过的速度非常慢.这是我的结果:

Regular clean build without ccache : 1m40s
First build with ccache : 4m36s
Second build with ccache : 30s
Run Code Online (Sandbox Code Playgroud)

我不知道从哪里开始调试.性能页面(https://ccache.samba.org/performance.html)提到了make文件的复杂性如何降低编译速度,但在这种情况下我使用Xcode,因此ccache的调用应该相对较快.我期待一些性能下降,但不是这么多!

使用版本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
Run Code Online (Sandbox Code Playgroud)

请注意,如果改变了某些内容,我会使用pch.

小智 5

您可以运行命令“ccache -s”来查看统计信息。

从这个 ccache 错误线程https://github.com/ccache/ccache/issues/54末尾的实验来看,尝试减少使用的并行内核编译器可能会有所帮助,来自多个进程的文件锁定可能是根本原因。