Repository navigation
Cache missing property names of unions - #65435
Closed
Jake Bailey (jakebailey) wants to merge 1 commit into
Closed
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The cache-mode test leaves repeated misses and lookup-mode isolation untested, so negative cache entries could incorrectly hide valid augmented members.
1 open issue
What changed in this PR
This PR reduces repeated property-lookup work in the native TypeScript checker by caching missing property names on unions and intersections.
Changes:
- Track missing properties separately for augmented and non-augmented lookups.
- Return cached misses without scanning constituents again.
| File | Description |
|---|---|
tsc/internal/checker/types.go |
Adds the missing-property cache and lookup-mode flags. |
tsc/internal/checker/checker.go |
Checks cached misses and records unsuccessful property lookups. |
Review effort: Balanced
Comment on lines
+22071
to
+22072
| if data.missingProperties[name]&lookup != 0 { | ||
| return nil |
Contributor
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jake Bailey (jakebailey)
marked this pull request as draft
November 10, 2026 23:54
Many property lookups on a union are of names it lacks, such as when narrowing by a discriminant, and each one looked through every constituent again, since only properties found were cached. Most missing names are looked up only once, though, and caching every one grows the caches of large projects such as MUI's docs considerably, so a name is cached once it is missed a second time, which a small filter of earlier misses tells. Symbol tables cannot hold a missing entry, so the missing names are kept apart, for each kind of lookup.
Jake Bailey (jakebailey)
force-pushed
the
perf/cache-missing-union-properties
branch
from
November 11, 2026 02:39
0949f43 to
07afcb0
Compare
Jake Bailey (jakebailey)
deleted the
perf/cache-missing-union-properties
branch
November 11, 2026 03:01
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.

Most property lookups on a union are on names that don't exist, e.g. narrowing by a discriminant, so this saves tome time.