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

Skip to content

[ty] Compact retained definition maps#25737

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/compact-retained-definition-maps
Jun 12, 2026
Merged

[ty] Compact retained definition maps#25737
charliermarsh merged 1 commit into
mainfrom
charlie/compact-retained-definition-maps

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Summary

DefinitionsByNode and UseDefMap::definitions_by_definition currently retain hash tables after semantic indexing has finished, even though the retained semantic index only needs deterministic keyed lookup.

This changes those retained maps to use the existing sorted FrozenMap representation. The builders continue to use hash maps while constructing the semantic index, then freeze the final entries into sorted slices before returning the cached value.

On the PyTorch memory benchmark, this reduced retained memory by 5.66 MB (0.40%).

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

astral-sh-bot Bot commented Jun 8, 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 94.36%. The percentage of expected errors that received a diagnostic held steady at 88.82%. The number of fully passing files held steady at 93/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 35.20MB 34.87MB -0.93% (333.70kB) ⬇️
trio 86.73MB 86.13MB -0.69% (608.85kB) ⬇️
sphinx 203.95MB 202.78MB -0.57% (1.17MB) ⬇️
prefect 555.47MB 552.11MB -0.60% (3.36MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
semantic_index 9.80MB 9.47MB -3.33% (333.70kB) ⬇️

trio

Name Old New Diff Outcome
semantic_index 21.27MB 20.67MB -2.80% (608.85kB) ⬇️

sphinx

Name Old New Diff Outcome
semantic_index 43.68MB 42.51MB -2.68% (1.17MB) ⬇️

prefect

Name Old New Diff Outcome
semantic_index 130.61MB 127.25MB -2.57% (3.36MB) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented Jun 8, 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/compact-retained-definition-maps branch from 9e7490b to c2bc4e7 Compare June 8, 2026 11:29
@charliermarsh charliermarsh force-pushed the charlie/compact-retained-definition-maps branch from c2bc4e7 to 882d8fe Compare June 12, 2026 01:08
@charliermarsh charliermarsh marked this pull request as ready for review June 12, 2026 01:39
@charliermarsh charliermarsh merged commit fb186b2 into main Jun 12, 2026
59 checks passed
@charliermarsh charliermarsh added the performance Potential performance improvement label Jun 12, 2026
@charliermarsh charliermarsh deleted the charlie/compact-retained-definition-maps branch June 12, 2026 01:39
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