The benefits / disadvantages of unity builds?(统一构建的好处/坏处?)
问题描述
自从在一家新公司开始工作以来,我注意到他们在我们的大部分解决方案中使用了 unity cpp 文件,我想知道是否有人能够给我一个明确的理由来说明为什么以及如何加速构建过程?我原以为在 unity 文件中编辑一个 cpp 文件会强制重新编译所有文件.
Since starting at a new company I've noticed that they use unity cpp files for the majority of our solution, and I was wondering if anyone is able to give me a definitive reason as to why and how these speed up the build process? I would've thought that editing one cpp file in the unity files will force recompilation of all of them.
推荐答案
非常相似的问题和很好的答案在这里:#include 所有 .cpp 文件到一个编译单元?
Very similar question and good answers here: #include all .cpp files into a single compilation unit?
总结起来似乎是减少 I/O 开销是主要的好处.
The summary seems to be that less I/O overhead is the major benefit.
另请参阅Unity Builds 的魔力,链接在上面的问题也是如此.
See also The Magic Of Unity Builds as linked in the above question as well.
这篇关于统一构建的好处/坏处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:统一构建的好处/坏处?
- 静态初始化顺序失败 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 从python回调到c++的选项 2022-11-16
- STL 中有 dereference_iterator 吗? 2022-01-01
- 近似搜索的工作原理 2021-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- C++ 协变模板 2021-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01