Repository navigation
Avoid hashing keys in active mapper instantiation caches - #64871
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
Every instantiation under an active mapper built and hashed a 128-bit
key before probing the mapper's cache, even when the mapper had just
been pushed and its cache was necessarily empty. Most keys carry no
alias, so the type ID alone identifies the entry.
Measured with --checkers 4 (n=8):
│ before.txt │ after.txt │
│ sec/op │ sec/op vs base │
Tsc/bluesky 2.756 ± 3% 2.742 ± 3% ~ (p=0.366 n=8)
Tsc/sentry 11.20 ± 3% 11.19 ± 4% ~ (p=0.742 n=8)
Tsc/t3code-server 10.84 ± 3% 10.72 ± 2% -1.10% (p=0.038 n=8)
geomean 6.942 6.902 -0.58%
│ before.txt │ after.txt │
│ rss-B │ rss-B vs base │
Tsc/bluesky 1.190Gi ± 1% 1.182Gi ± 3% ~ (p=0.798 n=8)
Tsc/sentry 3.438Gi ± 7% 3.518Gi ± 6% ~ (p=0.645 n=8)
Tsc/t3code-server 2.852Gi ± 2% 2.879Gi ± 3% ~ (p=0.721 n=8)
geomean 2.268Gi 2.287Gi +0.86%
│ before.txt │ after.txt │
│ heap-B │ heap-B vs base │
Tsc/bluesky 934.9Mi ± 0% 934.8Mi ± 0% ~ (p=0.959 n=8)
Tsc/sentry 2.607Gi ± 0% 2.609Gi ± 0% ~ (p=0.382 n=8)
Tsc/t3code-server 2.303Gi ± 0% 2.302Gi ± 0% ~ (p=0.083 n=8)
geomean 1.763Gi 1.763Gi -0.00%
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused optimization preserves cache behavior, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Optimizes the compiler’s active mapper instantiation cache to reduce unnecessary key hashing.
Changes:
- Skips cache lookup and key construction for newly pushed mappers.
- Uses type IDs directly for alias-free keys, retaining hashing for aliased types.
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Streamlines mapper cache lookups and adds optimized key generation. |
Review effort: Balanced
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.
Every instantiation under an active mapper built and hashed a 128-bit key before probing the mapper's cache, even when the mapper had just been pushed and its cache was necessarily empty. Most keys carry no alias, so the type ID alone identifies the entry.
Measured with --checkers 4 (n=8):