0

So I found that my build is very slow with CMake when I do install. One package in particular is taking ~1:20 minutes to build and ~1:40 to install.

It's not installing terrabytes of data, and installation is just moving some files around, so I was wondering why it's so slow.

Now I found that if I build with ccache, I got faster build times even with a cold cache.

Now I looked at the install times, and the package went down to ~40 seconds install time. Still a lot considering CMake is only copying ~50MB, but considerably faster than before.

How can this be? Is there some kind of contention on files that is resolved with ccache?

4

1 回答 1

1

ccache如果 CMake 只是在移动文件,则不可能改善问题,因为它仅作为编译器调用。

您可能会发现安装阶段实际上正在重建整个软件包,ccache因此这对您有所帮助,因为即使您开始冷,构建阶段也会填充缓存,然后当安装尝试再次重建所有内容时,它会命中缓存。

您可以尝试完全跳过构建步骤。只是说cmake --build install,让它理清在安装之前需要发生的事情。

于 2021-11-23T17:31:25.443 回答