Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Avoid caching specialization-invariant known instances#25816

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/fast-path-known-instance-specialization
Jun 10, 2026
Merged

[ty] Avoid caching specialization-invariant known instances#25816
charliermarsh merged 1 commit into
mainfrom
charlie/fast-path-known-instance-specialization

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Summary

apply_specialization already handles atomic types before entering its tracked query, but several KnownInstanceType variants still create and retain query entries even though specialization always returns the original type.

This handles those specialization-invariant known instances directly. Variants that can depend on type variables continue through the existing tracked implementation.

@charliermarsh charliermarsh added the ty Multi-file analysis & type inference label Jun 10, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 92.23%. The percentage of expected errors that received a diagnostic held steady at 87.42%. The number of fully passing files held steady at 92/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 35.36MB 35.36MB -0.00% (640.00B) ⬇️
trio 87.65MB 87.65MB -0.00% (2.13kB) ⬇️
prefect 562.57MB 562.57MB -0.00% (7.48kB) ⬇️
sphinx 207.20MB 207.19MB -0.01% (11.19kB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
Type<'db>::apply_specialization_inner_::interned_arguments 170.86kB 170.55kB -0.18% (320.00B) ⬇️
Type<'db>::apply_specialization_inner_ 181.82kB 181.60kB -0.12% (224.00B) ⬇️
infer_deferred_types 443.04kB 442.94kB -0.02% (96.00B) ⬇️

trio

Name Old New Diff Outcome
infer_deferred_types 1.78MB 1.78MB -0.05% (912.00B) ⬇️
Type<'db>::apply_specialization_inner_::interned_arguments 505.31kB 504.61kB -0.14% (720.00B) ⬇️
Type<'db>::apply_specialization_inner_ 557.27kB 556.78kB -0.09% (504.00B) ⬇️
infer_definition_types 6.43MB 6.43MB -0.00% (48.00B) ⬇️

prefect

Name Old New Diff Outcome
Type<'db>::apply_specialization_inner_::interned_arguments 2.79MB 2.79MB -0.11% (3.28kB) ⬇️
Type<'db>::apply_specialization_inner_ 3.18MB 3.18MB -0.07% (2.30kB) ⬇️
infer_deferred_types 9.00MB 9.00MB -0.01% (1.12kB) ⬇️
infer_definition_types 74.05MB 74.04MB -0.00% (528.00B) ⬇️
StaticClassLiteral<'db>::own_fields_ 134.57kB 134.34kB -0.17% (240.00B) ⬇️
infer_scope_types_impl 47.64MB 47.64MB -0.00% (24.00B) ⬇️

sphinx

Name Old New Diff Outcome
Type<'db>::apply_specialization_inner_::interned_arguments 1.40MB 1.39MB -0.32% (4.61kB) ⬇️
Type<'db>::apply_specialization_inner_ 1.52MB 1.51MB -0.21% (3.23kB) ⬇️
infer_deferred_types 4.01MB 4.01MB -0.05% (1.85kB) ⬇️
infer_definition_types 20.21MB 20.21MB -0.00% (936.00B) ⬇️
infer_scope_types_impl 12.55MB 12.54MB -0.00% (504.00B) ⬇️
PEP695TypeAliasType<'db>::raw_value_type_ 5.74kB 5.69kB -0.82% (48.00B) ⬇️
Type<'db>::expand_eagerly__ 11.58kB 11.54kB -0.40% (48.00B) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@charliermarsh charliermarsh marked this pull request as ready for review June 10, 2026 13:02
@charliermarsh charliermarsh merged commit bde9bb5 into main Jun 10, 2026
59 checks passed
@charliermarsh charliermarsh added the performance Potential performance improvement label Jun 10, 2026
@charliermarsh charliermarsh deleted the charlie/fast-path-known-instance-specialization branch June 10, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Potential performance improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants