Skip to content

[ty] Use compact sets for more immutable fields#25476

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/compact-set
May 30, 2026
Merged

[ty] Use compact sets for more immutable fields#25476
charliermarsh merged 1 commit into
mainfrom
charlie/compact-set

Conversation

@charliermarsh

@charliermarsh charliermarsh commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

More memory savings and almost multiple percentage point performance increases on some projects.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label May 30, 2026
@astral-sh-bot

astral-sh-bot Bot commented May 30, 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 91.94%. The percentage of expected errors that received a diagnostic held steady at 87.09%. The number of fully passing files held steady at 92/134.

@astral-sh-bot

astral-sh-bot Bot commented May 30, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 44.02MB 43.95MB -0.17% (74.94kB) ⬇️
trio 109.49MB 109.13MB -0.33% (367.79kB) ⬇️
sphinx 261.77MB 261.06MB -0.27% (727.66kB) ⬇️
prefect 711.45MB 709.52MB -0.27% (1.94MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
infer_definition_types 1.85MB 1.78MB -3.68% (69.80kB) ⬇️
infer_scope_types_impl 871.37kB 868.14kB -0.37% (3.23kB) ⬇️
infer_statement_types_impl 50.73kB 49.98kB -1.48% (768.00B) ⬇️
infer_expression_types_impl 1.09MB 1.09MB -0.06% (704.00B) ⬇️
infer_deferred_types 513.27kB 512.80kB -0.09% (488.00B) ⬇️

trio

Name Old New Diff Outcome
infer_definition_types 7.73MB 7.40MB -4.23% (334.73kB) ⬇️
infer_scope_types_impl 4.14MB 4.12MB -0.40% (16.95kB) ⬇️
infer_expression_types_impl 6.75MB 6.74MB -0.16% (10.88kB) ⬇️
infer_deferred_types 2.11MB 2.11MB -0.20% (4.29kB) ⬇️
infer_statement_types_impl 56.64kB 55.70kB -1.66% (960.00B) ⬇️

sphinx

Name Old New Diff Outcome
infer_definition_types 24.01MB 23.39MB -2.60% (638.64kB) ⬇️
infer_scope_types_impl 13.46MB 13.42MB -0.33% (45.84kB) ⬇️
infer_expression_types_impl 21.96MB 21.93MB -0.13% (29.06kB) ⬇️
infer_statement_types_impl 562.02kB 552.60kB -1.68% (9.42kB) ⬇️
infer_deferred_types 4.82MB 4.82MB -0.10% (4.70kB) ⬇️

prefect

Name Old New Diff Outcome
infer_definition_types 89.93MB 88.41MB -1.70% (1.52MB) ⬇️
infer_scope_types_impl 50.85MB 50.63MB -0.43% (226.45kB) ⬇️
infer_deferred_types 10.49MB 10.39MB -0.87% (93.74kB) ⬇️
infer_expression_types_impl 60.37MB 60.29MB -0.14% (86.77kB) ⬇️
infer_statement_types_impl 1.08MB 1.06MB -1.30% (14.31kB) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented May 30, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@codspeed-hq

codspeed-hq Bot commented May 30, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 6.95%

⚡ 1 improved benchmark
✅ 64 untouched benchmarks
⏩ 60 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime pydantic 37.1 s 34.7 s +6.95%

Tip

Curious why this is faster? Use the CodSpeed MCP and ask your agent.


Comparing charlie/compact-set (87150f6) with main (6c88390)

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/compact-set branch from 6459b18 to 87150f6 Compare May 30, 2026 09:42
@charliermarsh charliermarsh marked this pull request as ready for review May 30, 2026 13:46
@astral-sh-bot astral-sh-bot Bot requested a review from dhruvmanila May 30, 2026 13:46
@charliermarsh charliermarsh merged commit 6d2ca1a into main May 30, 2026
92 of 95 checks passed
@charliermarsh charliermarsh deleted the charlie/compact-set branch May 30, 2026 13:47
@charliermarsh charliermarsh added the performance Potential performance improvement label May 30, 2026
@dhruvmanila

Copy link
Copy Markdown
Member

Neat!

carljm added a commit that referenced this pull request Jun 1, 2026
* main:
  [`pydocstyle`] Improve discoverability of rules enabled for each convention (#24973)
  [ty] Deduplicate retained use-def place states (#25450)
  [ty] reduce features of low-level crates depended on by `ty_python_semantic` (#25524)
  [ty] Fix narrowing enum literal unions by member identity (#25520)
  [ty] Test tagged union narrowing for named tuples (#25519)
  [ty] Disallow file-system access in `ty_python_core` (#25518)
  [ty] Nominal Tagged Union Narrowing (#24916)
  Commit `scripts/uv.lock` (#25517)
  Fix potential index out of range in `LineIndex` computation (#25492)
  [ty] Sync vendored typeshed stubs (#25514)
  [ty] Add disjointness for protocol method members (#25315)
  [ty] Use compact sets for more immutable fields (#25476)
  [ty] Derive `Default` for `FunctionDecoratorInference` (#25482)
  [ty] Ignore rejected assignments for synthesized bindings (#25340)
  [ty] Handle cycles in function decorator inference (#25475)
  docs: fix typo `bin/active` → `bin/activate` in tutorial (#25473)
  [ty] Narrow bound method overloads by receiver (#24707)
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