SIGN IN SIGN UP
astral-sh / ruff UNCLAIMED

An extremely fast Python linter and code formatter, written in Rust.

0 0 36 Rust

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?
M
Micha Reiser committed
1518f1d5fdcc92d207c5018bac6d0b9110643240
Parent: 572e4b5
Committed by GitHub <noreply@github.com> on 5/29/2026, 6:17:16 PM