[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 13:21:10 PDT 2023


jansvoboda11 wrote:

> > in my experience, it's not actually referenced in most modules
> 
> Can you clarify what you looked at here? I assume you checked non-scanner modules as well?

I took a typical Xcode project and chose one TU that happens to transitively depend on 37 modules. I built it with implicit modules and scanned its dependencies while counting all `SourceManager` requests specifically asking for the predefines `SLocEntry`:

| workload       | cache | before | after | change [%] |
|----------------|-------|--------|-------|------------|
| implicit build | clean |   2077 |  1197 |      -42.4 |
| implicit build |  full |     84 |    19 |      -77.3 |
| scan           | clean |   1015 |   568 |      -44.0 |
| scan           |  full |     39 |    18 |      -53.8 |

So saying *most* was incorrect. The data suggests that importers don't care about the predefines of ~43% of their transitive dependencies. Note that this number is higher when the cache is full, where the percentage only represents requests issued from the main TU. So it makes sense that deserializing predefines `SLocEntry` on-demand is a performance win, especially since it shouldn't have any overhead compared to the preloading approach.

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


More information about the cfe-commits mailing list