ruff
f24da129 - [ty] Use compact frozen representation for narrowing constraints (#25990)

Commit
91 days ago
[ty] Use compact frozen representation for narrowing constraints (#25990) ## Summary Narrowing analysis builds a map from each affected place to the constraint contributed by an expression or pattern. These results are cached, but once construction finishes we only read them; retaining each result as an `FxHashMap` therefore keeps hash-table storage that the cached value no longer needs. This keeps `FxHashMap` in `NarrowingConstraintsBuilder` for efficient construction, then converts each completed result to a `FrozenMap`, whose sorted boxed slice provides binary-search lookup without retaining hash-table capacity. In the memory report, this reduced retained memory for `all_narrowing_constraints_for_expression` by 40.1–45.6% across Flake8, Trio, Sphinx, and Prefect, reducing total retained memory by 0.2–1.1%. The typing-conformance and ecosystem comparisons reported no diagnostic changes.
Author
Parents
Loading