Repository navigation
Optimize relation keys into a custom table - #65814
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No actionable issues were found in the reviewed changes.
No open issues 🎉
What changed in this PR
Optimizes the compiler’s type-relation cache by using packed keys and a custom table for simple relations, while retaining hashed keys for other cases.
Changes:
- Adds a pointer-free, open-addressed relation table.
- Optimizes tracking of pending recursive comparisons.
- Preserves hashed-key fallback for generic relations and oversized type IDs.
| File | Description |
|---|---|
tsc/internal/checker/relater.go |
Implements the custom table and pending-comparison tracking; streamlines property filtering. |
tsc/internal/checker/checker.go |
Selects packed or hashed relation keys. |
Review effort: Balanced
Jake Bailey (jakebailey)
force-pushed
the
fast-pr/relation-packed-table
branch
from
December 4, 2026 23:12
c4a7331 to
052142d
Compare
Type relation lookups previously hashed 128-bit keys into a Go map for
every pair and tracked recursion assumptions in a map-backed set.
Pack simple (sourceId, targetId, intersectionState) relation keys and
results into a pointer-free uint64 open-addressing table, and scan
short Relater maybe-key stacks linearly before promoting to a map.
benchstat (-pgo=off, parent vs commit, n=6):
goos: linux
goarch: amd64
│ old │ new │
│ sec/op │ sec/op vs base │
Tsc/vscode 6.362 ± 2% 6.227 ± 1% -2.11% (p=0.004 n=6)
Tsc/mui-docs 3.837 ± 2% 3.761 ± 1% -1.98% (p=0.015 n=6)
geomean 4.941 4.840 -2.05%
│ old │ new │
│ B-rss │ B-rss vs base │
Tsc/vscode 4.702Gi ± 3% 4.615Gi ± 2% ~ (p=0.240 n=6)
Tsc/mui-docs 2.184Gi ± 7% 2.126Gi ± 7% ~ (p=0.132 n=6)
geomean 3.204Gi 3.132Gi -2.26%
Jake Bailey (jakebailey)
force-pushed
the
fast-pr/relation-packed-table
branch
from
December 4, 2026 23:24
052142d to
04021e4
Compare
Jake Bailey (jakebailey)
marked this pull request as ready for review
December 4, 2026 23:40
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Contributor
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another case where a custom map works well to avoid double hashing, etc.
Let happy about this one but it does help.
benchstat (-pgo=off, parent vs commit, n=6):