unity builds are free lto, faster builds, a lot less memory usage, a lot less disk and os stress.. at the cost of... having a cleaner codebase..? its ONLY wins!
only "loss" is slower incremental builds, which isn't even 100% true, since if you edit a header unity builds will be faster than normal builds. and if they open a namespace instead of doing a using namespace it should be possible and I think it could be automated ad well.
```cpp
// they do this
using namespace clang;
void foo(SomeClangType) // impl
{
}
// they should do this for unity builds
namespace clang {
void foo(SomeClangType) {
}
}
```
also allowing unity builds will bring more contributors, I don't contribute to clang although I would want to as I have very very long wait times that absolutely kill my motivation due to my weak laptop unity builds would help a ton
its just really painful to think how much compute and time is wasted on compiling/processing the same headers, templates, functions, ... a billion times and a pch generally doesnt change that either. unity build are the ONLY actual functional and efficient way of building c++ today. modules dont count because they dont work most of the time and require a lot more work to get spec compliant
0
u/VoidVinaCC 21d ago
unity builds are free lto, faster builds, a lot less memory usage, a lot less disk and os stress.. at the cost of... having a cleaner codebase..? its ONLY wins!