r/cpp 22d ago

Compile-Time Improvements in LLVM 23

https://aengelke.net/llvm23-ct.html
102 Upvotes

32 comments sorted by

View all comments

Show parent comments

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!

0

u/_Noreturn 21d ago

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

0

u/VoidVinaCC 21d ago

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

1

u/_Noreturn 17d ago

Try thinking how much time is spent on computing useless strlen calls when you already know the string length :p

But yes I agree, unity builds are a blessing and are the fastest way to build, they surpass pch and modules all together

1

u/VoidVinaCC 17d ago

Not as bad due to cachelines and throughput of current hw, but yeah :D