Skip to content

[ty] Widen nested literals during inference for huge collections#24716

Closed
charliermarsh wants to merge 5 commits intomainfrom
charlie/promote-perf
Closed

[ty] Widen nested literals during inference for huge collections#24716
charliermarsh wants to merge 5 commits intomainfrom
charlie/promote-perf

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh commented Apr 19, 2026

Summary

Discovered as part of: astral-sh/ty#1393.

@charliermarsh charliermarsh added the performance Potential performance improvement label Apr 19, 2026
@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 19, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 19, 2026

Typing conformance results

No changes detected ✅

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

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 19, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 47.76MB 47.76MB -
trio 117.03MB 117.03MB -
prefect 679.02MB 679.00MB -0.00% (16.57kB) ⬇️
sphinx 260.04MB 260.00MB -0.02% (40.10kB) ⬇️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
Type<'db>::class_member_with_policy_ 16.94MB 16.93MB -0.05% (8.20kB) ⬇️
Type<'db>::member_lookup_with_policy_ 15.83MB 15.82MB -0.03% (4.34kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 9.90MB 9.89MB -0.02% (1.52kB) ⬇️
Type<'db>::member_lookup_with_policy_::interned_arguments 5.98MB 5.98MB -0.02% (1.52kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 3.00MB 3.00MB -0.01% (400.00B) ⬇️
infer_definition_types 86.06MB 86.06MB -0.00% (324.00B) ⬇️
Type<'db>::apply_specialization_ 3.63MB 3.63MB -0.01% (280.00B) ⬇️

sphinx

Name Old New Diff Outcome
TupleType 549.62kB 515.23kB -6.26% (34.39kB) ⬇️
function_known_decorators 1.11MB 1.11MB -0.17% (1.98kB) ⬇️
infer_deferred_types 5.27MB 5.27MB -0.04% (1.98kB) ⬇️
infer_definition_types 23.90MB 23.90MB -0.00% (972.00B) ⬇️
try_call_bin_op_return_type_impl 205.95kB 205.50kB -0.22% (468.00B) ⬇️
TupleType<'db>::to_class_type_ 147.57kB 147.44kB -0.09% (140.00B) ⬇️
Specialization 1002.39kB 1002.28kB -0.01% (112.00B) ⬇️
GenericAlias 417.94kB 417.87kB -0.02% (72.00B) ⬇️
infer_expression_types_impl 20.47MB 20.47MB -0.00% (24.00B) ⬇️

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 19, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 19, 2026

Merging this PR will improve performance by ×5.6

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 55 untouched benchmarks
⏩ 60 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ty_micro[typevar_mapping_accumulation] 370.7 ms 66.1 ms ×5.6
Memory ty_micro[typevar_mapping_accumulation] 32.6 MB 13.5 MB ×2.4

Comparing charlie/promote-perf (acd41cb) with main (e002c44)

Open in CodSpeed

Footnotes

  1. 60 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@charliermarsh charliermarsh force-pushed the charlie/promote-perf branch 3 times, most recently from ee4b6e2 to 80d61d1 Compare April 20, 2026 17:58
@charliermarsh charliermarsh force-pushed the charlie/promote-perf branch from 80d61d1 to 5c219df Compare May 2, 2026 12:20
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.

1 participant