Repository navigation
Store ordinary relationship keys as exact type ID pairs - #64788
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
Jake Bailey (jakebailey)
added this pull request to stack #64792
October 13, 2026 17:37
Jake Bailey (jakebailey)
marked this pull request as ready for review
October 13, 2026 17:42
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused cache representation change preserves existing semantics and has comprehensive unit coverage.
0 open findings
What changed in this PR
Optimizes relationship caching by storing ordinary comparisons as exact 64-bit type-ID pairs while preserving generic hashes.
Changes:
- Splits ordinary and generic relation caches.
- Packs ordinary type IDs into collision-free keys.
- Adds coverage for key states, namespaces, and generic normalization.
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Generates packed ordinary keys and hashed generic keys. |
tsc/internal/checker/relater.go |
Implements separate relation caches. |
tsc/internal/checker/types_test.go |
Tests relation-key behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/indexed-type-node-caches
branch
from
October 13, 2026 18:36
6360afc to
e7a1293
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 18:36
98420cf to
46ffb18
Compare
Jake Bailey (jakebailey)
marked this pull request as draft
October 13, 2026 19:41
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/indexed-type-node-caches
branch
from
October 13, 2026 20:06
e7a1293 to
e46e706
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 20:06
46ffb18 to
3b5631d
Compare
Base automatically changed from
jakebailey/mem/indexed-type-node-caches
to
jakebailey/mem/compact-member-indexes
October 13, 2026 20:06
Jake Bailey (jakebailey)
removed this pull request from stack #64792
October 13, 2026 20:15
Jake Bailey (jakebailey)
added this pull request to stack #64805
October 13, 2026 20:16
Jake Bailey (jakebailey)
removed this pull request from stack #64805
October 13, 2026 20:49
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 13, 2026 20:50
5aa1029 to
621e8f2
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 20:50
3b5631d to
2b8f9af
Compare
Jake Bailey (jakebailey)
added this pull request to stack #64806
October 13, 2026 20:50
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 21:39
2b8f9af to
f7addbf
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
2 times, most recently
from
October 13, 2026 22:00
0f3d124 to
11f0df8
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 22:00
f7addbf to
2a5167f
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 22:25
2a5167f to
51be58b
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 13, 2026 22:25
11f0df8 to
48d2bb2
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 23:08
51be58b to
f34f38a
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 13, 2026 23:08
48d2bb2 to
f2431d1
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 13, 2026 23:16
f34f38a to
e59a4dd
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
2 times, most recently
from
October 13, 2026 23:18
d1038c7 to
da3177f
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
2 times, most recently
from
October 14, 2026 01:07
a15ee39 to
a94e6ec
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 14, 2026 02:23
bf46f3e to
c4938e8
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
2 times, most recently
from
October 14, 2026 02:27
59c8a48 to
ad1de82
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 14, 2026 02:27
c4938e8 to
22ec779
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 14, 2026 03:47
ad1de82 to
354885c
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 14, 2026 03:47
22ec779 to
3654528
Compare
Anders Hejlsberg (ahejlsberg)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 14, 2026 14:14
354885c to
0e30e19
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 14, 2026 14:17
0e30e19 to
8455c76
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/compact-member-indexes
branch
from
October 14, 2026 14:17
7265ad1 to
04c2a42
Compare
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 14, 2026 16:02
8455c76 to
953c7fb
Compare
Ordinary type comparisons need only two 32-bit IDs and intersection
context, but retained a 128-bit hash for every cached result. Hashing
and storing twice the necessary key width wastes allocations and memory.
Keep exact 64-bit pairs in separate maps for the four intersection
states. Generic-reference normalization still uses its original
full-width hash. An explicit key tag separates both namespaces,
including recursion guards, without sacrificing hash bits or changing
constrained generic behavior.
Six fresh-process interleaved VS Code comparisons against the parent
commit, using normal GC, reduce retained heap 0.94% (roughly 33 MiB) and
total allocated bytes 1.29%. GC scanning, allocation events, and
instruction counts are not statistically different.
Tests cover directional and identity comparisons, all intersection
contexts, result replacement, exact high-bit IDs, namespace isolation,
generic parameter normalization, and constrained versus unconstrained
recursion keys.
Production diagnostics
and all semantic counts match exactly.
goos: linux
goarch: amd64
pkg: github.com/microsoft/TypeScript/tsc/internal/checker
cpu: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ retained-B │ retained-B vs base │
ExternalProgram-20 3.456Gi ± 0% 3.424Gi ± 0% -0.94% (p=0.002 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ scan-B │ scan-B vs base │
ExternalProgram-20 2.998Gi ± 0% 2.997Gi ± 0% ~ (p=0.310 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ B/op │ B/op vs base │
ExternalProgram-20 5.021Gi ± 0% 4.956Gi ± 0% -1.29% (p=0.002 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ allocs/op │ allocs/op vs base │
ExternalProgram-20 31.08M ± 0% 31.07M ± 0% ~ (p=0.240 n=6)
│ relation-before-instructions.txt │ relation-instructions.txt │
│ instructions/op │ instructions/op vs base │
ExternalInstructions-20 269.3G ± 2% 270.0G ± 3% ~ (p=0.937 n=6)
Jake Bailey (jakebailey)
removed this pull request from stack #64806
October 14, 2026 16:55
Jake Bailey (jakebailey)
changed the base branch from
jakebailey/mem/compact-member-indexes
to
main
October 14, 2026 16:56
Jake Bailey (jakebailey)
force-pushed
the
jakebailey/mem/exact-relation-keys
branch
from
October 14, 2026 16:56
953c7fb to
8f3ee02
Compare
Jake Bailey (jakebailey)
marked this pull request as ready for review
October 14, 2026 16:58
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Jake Bailey (jakebailey)
requested a review
from Anders Hejlsberg (ahejlsberg)
October 14, 2026 17:21
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.
Ordinary comparisons only need two 32-bit type IDs, but each cached result stored a 128-bit hash.