Commit eedbf7c
committed
[clang][modules] Optimize construction and usage of the submodule index (llvm#113391)
This patch avoids eagerly populating the submodule index on `Module`
construction. The `StringMap` allocation shows up in my profiles of
`clang-scan-deps`, while the index is not necessary most of the time. We
still construct it on-demand.
Moreover, this patch avoids performing qualified submodule lookup in
`ASTReader` whenever we're serializing a module graph whose top-level
module is unknown. This is pointless, since that's guaranteed to never
find any existing submodules anyway.
This speeds up `clang-scan-deps` by ~0.5% on my workload.
(cherry picked from commit 6c6351e)1 parent ab6adca commit eedbf7c
File tree
5 files changed
+42
-29
lines changed- clang
- include/clang
- Basic
- Lex
- lib
- Basic
- Lex
- Serialization
5 files changed
+42
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
633 | 632 | | |
634 | 633 | | |
635 | 634 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
560 | 563 | | |
561 | 564 | | |
562 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
358 | 357 | | |
359 | 358 | | |
360 | 359 | | |
361 | | - | |
362 | | - | |
363 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
364 | 363 | | |
365 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
658 | | - | |
659 | | - | |
| 658 | + | |
| 659 | + | |
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
676 | | - | |
| 675 | + | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
| 869 | + | |
| 870 | + | |
873 | 871 | | |
874 | 872 | | |
875 | | - | |
| 873 | + | |
876 | 874 | | |
877 | 875 | | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
878 | 884 | | |
879 | 885 | | |
880 | 886 | | |
| |||
884 | 890 | | |
885 | 891 | | |
886 | 892 | | |
887 | | - | |
| 893 | + | |
888 | 894 | | |
889 | 895 | | |
890 | 896 | | |
| |||
2135 | 2141 | | |
2136 | 2142 | | |
2137 | 2143 | | |
2138 | | - | |
2139 | | - | |
| 2144 | + | |
2140 | 2145 | | |
2141 | 2146 | | |
2142 | 2147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5756 | 5756 | | |
5757 | 5757 | | |
5758 | 5758 | | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
5759 | 5766 | | |
5760 | 5767 | | |
5761 | 5768 | | |
| |||
5837 | 5844 | | |
5838 | 5845 | | |
5839 | 5846 | | |
5840 | | - | |
5841 | | - | |
5842 | | - | |
5843 | | - | |
5844 | | - | |
| 5847 | + | |
| 5848 | + | |
5845 | 5849 | | |
5846 | 5850 | | |
5847 | 5851 | | |
| |||
0 commit comments