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.
这篇关于统一构建的好处/坏处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:统一构建的好处/坏处?
基础教程推荐
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- c++ STL设置差异 2022-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
