r/cpp • u/holyblackcat • Mar 09 '26
The compilation procedure for C++20 modules
https://holyblackcat.github.io/blog/2026/03/09/compiling-modules.html
103
Upvotes
r/cpp • u/holyblackcat • Mar 09 '26
View all comments
-4
u/HassanSajjad302 HMake Mar 09 '26
Your article is very detailed. I would link it in my software.
There is another model to support module compilation that is without scanning them first. HMake is the only build-system that supports it and I am proposing it for LLVM. I will be sharing an update here. https://discourse.llvm.org/t/rfc-hmake-for-llvm/88997/7
The way HMake supports this, there is absolutely zero disadvantage and there are multiple advantages.
HMake is the only build-system that can do
On performance: HMake is 4–5× faster than Ninja on no-op rebuilds while achieving full parity on from-scratch builds. This benchmark compares LLVM compilation using Ninja vs. HMake across four configurations.
> Something tells me 1 is not a good strategy, as it forces importers to consume the full BMIs instead of reduced BMIs.
Full BMI step is faster than generating the reduced BMI as well. As it involves backend optimizations which is the slower part. Using full BMIs means consumers are not blocked waiting for that slower step to complete. And in HMake, the consuming processes read the BMI as shared-memory files. So the read costs are very minimal even with big size.
If you have more time, please review my software.