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

Skip to content

[ty] Consolidate retained use-def definition maps#25499

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/consolidate-use-def-maps
Jun 1, 2026
Merged

[ty] Consolidate retained use-def definition maps#25499
charliermarsh merged 1 commit into
mainfrom
charlie/consolidate-use-def-maps

Conversation

@charliermarsh

@charliermarsh charliermarsh commented May 31, 2026

Copy link
Copy Markdown
Member

Summary

When we build the use-def map, we retain prior bindings for each definition and prior declarations for each binding. These were previously stored in two separate hash maps, even though every entry in the declarations map had a corresponding entry in the bindings map.

This PR consolidates them into a single map. Each retained definition stores its prior bindings and, when needed, its
prior declarations. This removes the duplicated keys and the overhead of retaining a second hash table.

(The primary motivation here is reducing memory.)

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

astral-sh-bot Bot commented May 31, 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 31, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 43.16MB 42.87MB -0.67% (297.96kB) ⬇️
trio 107.20MB 106.66MB -0.50% (553.55kB) ⬇️
sphinx 256.42MB 255.31MB -0.43% (1.11MB) ⬇️
prefect 691.74MB 688.57MB -0.46% (3.18MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
semantic_index 12.14MB 11.85MB -2.40% (297.96kB) ⬇️

trio

Name Old New Diff Outcome
semantic_index 26.22MB 25.68MB -2.06% (553.55kB) ⬇️

sphinx

Name Old New Diff Outcome
semantic_index 53.93MB 52.83MB -2.05% (1.11MB) ⬇️

prefect

Name Old New Diff Outcome
semantic_index 157.85MB 154.67MB -2.01% (3.18MB) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented May 31, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh charliermarsh force-pushed the charlie/consolidate-use-def-maps branch from 93d500d to ccf3ac0 Compare June 1, 2026 14:56
@charliermarsh charliermarsh added the performance Potential performance improvement label Jun 1, 2026
@charliermarsh charliermarsh marked this pull request as ready for review June 1, 2026 19:51
@astral-sh-bot astral-sh-bot Bot requested a review from dhruvmanila June 1, 2026 19:51
@charliermarsh charliermarsh merged commit 06e7727 into main Jun 1, 2026
59 checks passed
@charliermarsh charliermarsh deleted the charlie/consolidate-use-def-maps branch June 1, 2026 19:54
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