Commit 1518f1d
authored
Drop excess capacity from Suites during parsing (#25368)
## Summary
Shrink Suite vectors to drop the excess capacity during parsing.
I excluded other nodes for now to get a better sense of the performance
and memory impact.
I'm a bit conflicted on this. This is a pretty huge memory improvement
for ty, but there are a few linter benchmarks that regress by 1-2%
because some vectors need to be copied to smaller allocations, which
hurts performance. For the linter and formatter, it's also not important
to shrink the vectors, because the AST is never stored for long. But
this is different for ty where we cache the AST.
I'm curious to hear what others think on this. I could also try to
reduce the places where we call `shrink_to_fit`, e.g., only for
statements?1 parent 572e4b5 commit 1518f1d
2 files changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| 522 | + | |
522 | 523 | | |
523 | 524 | | |
524 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
0 commit comments