[ty] Avoid caching atomic type specializations by charliermarsh · Pull Request #25663 · astral-sh/ruff (original) (raw)

Summary

apply_specialization currently creates and retains a Salsa query for every input type, including atomic types whose specialization always returns the original type.

This change handles those specialization-invariant variants before entering the tracked query. Types that can contain type variables continue through the existing tracked implementation, preserving specialization and cycle behavior.

On a large codebase, this reduced retained memory by 1.06% without a measurable runtime regression.