[clang] [Serialization] Fix lazy template loading (PR #133057)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 01:22:57 PDT 2025


ChuanqiXu9 wrote:

> ### Performance measurements with LLVM
> I tested these patches for building LLVM itself with modules (`LLVM_ENABLE_MODULES=ON`). To work around #130795, I apply #131354 before building Clang. In terms of overall performance for the entire build, I'm not able to measure a difference in memory consumption because that is dominated by the linker. The run time performance is very noisy, so it's hard to make accurate statements but it looks unaffected as well.
> 
> I did some measurements for individual files, chosen by searching for large object files and excluding generated files. For each version, I first build LLVM completely to populate the `module.cache` and then delete and rebuild only one object file. Run time performance is not hugely affected, it seems to get slightly faster with this PR.
> 
> `Maximum resident set size (kbytes)` from `/usr/bin/time -v`:
> 
> object file	before*	`main`	this PR
> `lib/Analysis/CMakeFiles/LLVMAnalysis.dir/ScalarEvolution.cpp.o`	543100	515184	445784
> `lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o`	923036	884160	805960
> `lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/AttributorAttributes.cpp.o`	639184	600076	522512
> `lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.o`	876580	857404	776572
> before*: reverting [fb2c9d9](https://github.com/llvm/llvm-project/commit/fb2c9d940ad87e6ae09e06c6915e0c925a4f87ec), [c5e4afe](https://github.com/llvm/llvm-project/commit/c5e4afe6733c58e24023ede04275bbed3bde8240), [30ea0f0](https://github.com/llvm/llvm-project/commit/30ea0f0ce476bf4c12684a9a514af2ca660bbe44), [20e9049](https://github.com/llvm/llvm-project/commit/20e904950967c125abc1e91f57e5a373987ff016) on current `main`

Out of curiosity, are you saying header modules are helpful to reduce the size of objects? This makes me surprise a little bit. I thought they are only helpful for parsing but not code generating.

https://github.com/llvm/llvm-project/pull/133057


More information about the cfe-commits mailing list