Commit 585bbef
authored
Add optimization to reduce extra iterations of the safe init checker. (#17057)
If the cache is never accessed on a certain iteration of safe
initializing checking for a class, then another iteration is not needed.
Implementing this optimization and compiling Dotty, we observe the
following improvements:
From 4158 total iterations to 4004.
From 460 extra iterations to 306.
Running the initialization tests in `tests/init` we have the following
improvements:
From 790 total iterations to 708.
From 139 extra iterations to 57.File tree
2 files changed
+13
-2
lines changed- compiler/src/dotty/tools/dotc/transform/init
2 files changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
82 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| |||
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
| 135 | + | |
| 136 | + | |
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
| |||
132 | 142 | | |
133 | 143 | | |
134 | 144 | | |
| 145 | + | |
135 | 146 | | |
136 | 147 | | |
137 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
1123 | | - | |
| 1123 | + | |
1124 | 1124 | | |
1125 | 1125 | | |
1126 | 1126 | | |
| |||
0 commit comments