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.
这篇关于统一构建的好处/坏处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:统一构建的好处/坏处?


基础教程推荐
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01