Commit 9d96b4c
committed
Garbage-collect expression ASTs
In parse_and_visit_expression, we know that an allocated expression
isn't used after calling visit_expression. Save memory by deleting the
entire expression tree allocated by parse_expression after calling
visit_expression.
This commit should not change behavior.
This memory usage optimization improves parsing performance:
--------------------------------------------------------------------------
When Benchmark Time CPU Iterations
--------------------------------------------------------------------------
before benchmark_parse_file 1634589 ns 1632770 ns 1710
after benchmark_parse_file 1621339 ns 1619349 ns 17471 parent b3da0e4 commit 9d96b4c
File tree
3 files changed
+60
-1
lines changed- src/quick-lint-js
3 files changed
+60
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
159 | 193 | | |
160 | 194 | | |
161 | 195 | | |
| |||
230 | 264 | | |
231 | 265 | | |
232 | 266 | | |
| 267 | + | |
233 | 268 | | |
234 | 269 | | |
235 | 270 | | |
| |||
268 | 303 | | |
269 | 304 | | |
270 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
271 | 316 | | |
272 | 317 | | |
273 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
274 | 323 | | |
275 | 324 | | |
276 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3673 | 3673 | | |
3674 | 3674 | | |
3675 | 3675 | | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
3676 | 3679 | | |
3677 | | - | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
3678 | 3686 | | |
3679 | 3687 | | |
3680 | 3688 | | |
| |||
0 commit comments