Commit 012f45e
authored
Auto merge of #35854 - nikomatsakis:incr-comp-cache-hash-35549, r=mw
compute and cache HIR hashes at beginning
This avoids the compile-time overhead of computing them twice. It also fixes
an issue where the hash computed after typeck is differen than the hash before,
because typeck mutates the def-map in place.
Fixes #35549.
Fixes #35593.
Some performance measurements suggest this `HashesMap` is very small in memory (unobservable via `-Z time-passes`) and very cheap to construct. I do see some (very minor) performance wins in the incremental case after the first run -- the first run costs more because loading the dep-graph didn't have any hashing to do in that case. Example timings from two runs of `libsyntex-syntax` -- the (1) indicates first run, (2) indicates second run, and (*) indicates both together:
| Phase | Master | Branch |
| ---- | ---- | ---- |
| compute_hashes_map (1) | N/A | 0.343 |
| load_dep_graph (1) | 0 | 0 |
| serialize dep graph (1) | 4.190 | 3.920 |
| total (1) | 4.190 | 4.260 |
| compute_hashes_map (2) | N/A | 0.344 |
| load_dep_graph (2) | 0.592 | 0.252 |
| serialize dep graph (2) | 4.119 | 3.779 |
| total (2) | 4.71 | 4.375 |
| total (*) | 8.9 | 8.635 |
r? @michaelwoeristerFile tree
19 files changed
+350
-176
lines changed- src
- librustc_driver
- librustc_incremental
- calculate_svh
- persist
- librustc_trans
- back
- librustc
- dep_graph
- hir
- librustdoc
- test/incremental
19 files changed
+350
-176
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1621 | 1621 | | |
1622 | 1622 | | |
1623 | 1623 | | |
1624 | | - | |
| 1624 | + | |
1625 | 1625 | | |
1626 | 1626 | | |
1627 | 1627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
| |||
797 | 798 | | |
798 | 799 | | |
799 | 800 | | |
| 801 | + | |
800 | 802 | | |
801 | 803 | | |
802 | 804 | | |
803 | | - | |
| 805 | + | |
804 | 806 | | |
805 | 807 | | |
806 | 808 | | |
807 | | - | |
| 809 | + | |
808 | 810 | | |
809 | 811 | | |
810 | 812 | | |
| |||
860 | 862 | | |
861 | 863 | | |
862 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
863 | 869 | | |
864 | 870 | | |
865 | | - | |
| 871 | + | |
866 | 872 | | |
867 | 873 | | |
868 | | - | |
| 874 | + | |
869 | 875 | | |
870 | 876 | | |
871 | 877 | | |
| |||
935 | 941 | | |
936 | 942 | | |
937 | 943 | | |
938 | | - | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
939 | 949 | | |
940 | 950 | | |
941 | 951 | | |
| |||
963 | 973 | | |
964 | 974 | | |
965 | 975 | | |
966 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
967 | 981 | | |
968 | 982 | | |
969 | | - | |
| 983 | + | |
970 | 984 | | |
971 | 985 | | |
972 | 986 | | |
973 | 987 | | |
974 | 988 | | |
975 | 989 | | |
976 | | - | |
| 990 | + | |
| 991 | + | |
977 | 992 | | |
978 | 993 | | |
979 | 994 | | |
| |||
1007 | 1022 | | |
1008 | 1023 | | |
1009 | 1024 | | |
1010 | | - | |
| 1025 | + | |
1011 | 1026 | | |
1012 | 1027 | | |
1013 | 1028 | | |
1014 | 1029 | | |
1015 | 1030 | | |
1016 | 1031 | | |
1017 | 1032 | | |
1018 | | - | |
| 1033 | + | |
1019 | 1034 | | |
1020 | 1035 | | |
1021 | 1036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
| 954 | + | |
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments