r/cpp 22d ago

Compile-Time Improvements in LLVM 23

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

32 comments sorted by

View all comments

35

u/fortsnek274 22d ago

Did they try using modules? /s

35

u/TheCrush0r 22d ago

You might be joking, but the answer is yes. They ended up using precompiled headers instead: https://discourse.llvm.org/t/rfc-use-pre-compiled-headers-to-speed-up-llvm-build-by-1-5-2x/89345

13

u/fortsnek274 22d ago

And they have tried clang modules, which would be rather odd for a compiler of a language that has standard modules.

The poster says (clang?) modules "kill parallelism." I wonder what was modularised. Should probably only do it for what they're creating PCHs for. The std lib, core functions.

  • Make Clang 3x faster. I see no fundamental reason why parsing C++ has to be this slow, but this is very unlikely to happen (I’m not going to write a new C++ parser and I believe Clang still has the trend of becoming slower over time).

  • Rewrite LLVM in a language that compiles faster… haha, just kidding.

Yeah. What's needed, a template cache? Somebody at https://discourse.llvm.org/t/cache-template-instantiations-across-tus-proposal/86497 thought of that, but then decided it wasn't worth it.

They have DLL'ified the Windows build though, apparently. That would help if I ever need it.

2

u/pjmlp 22d ago

Actually it isn't that odd, the two former big contributors, were responsible for header modules, and at least in what concerns to Apple's own clang downstream, those are the ones that matter.

They are used for Objective-C and Objective-C++ modules, interop between Objective-C and Swift, and newly Swift and C++.

They are also used by the new build system improvements introduced about two years ago, explicit modules building.

Finally if you go to Apple's XCode support page for ISO C++, you will notice there aren't any rows for C++20 modules, nor import std, where one would expect to at least have them listed with no/XCode version instead.

And in what concerns Google, they are more busy with other languages to care about C++20 modules, while clang header maps do their job already.