Repository navigation
Don't resolve mapped type members to find their signatures - #64873
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
Mapped types never have call or construct signatures, but asking for
their signatures resolved all of their properties. Signature checks
in relations ask for them first, so every mapped type that reached a
relation had its properties built, even when nothing else needed
them. In MUI, components accept Partial<...> of each intrinsic
element's props, so this built hundreds of properties for each of
thousands of such types, and their combined base properties too.
Measured with --checkers 4 (n=6):
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
Tsc/bluesky 2.459 ± 3% 2.458 ± 3% ~ (p=0.818 n=6)
Tsc/sentry 10.21 ± 4% 10.27 ± 3% ~ (p=0.937 n=6)
Tsc/t3code-server 8.097 ± 3% 8.085 ± 1% ~ (p=0.937 n=6)
Tsc/mui-docs 6.423 ± 4% 5.902 ± 4% -8.10% (p=0.002 n=6)
geomean 6.011 5.892 -1.98%
│ old.txt │ new.txt │
│ rss-B │ rss-B vs base │
Tsc/bluesky 1.184Gi ± 1% 1.176Gi ± 3% ~ (p=0.699 n=6)
Tsc/sentry 3.415Gi ± 5% 3.273Gi ± 5% ~ (p=0.240 n=6)
Tsc/t3code-server 2.875Gi ± 6% 2.913Gi ± 8% ~ (p=0.699 n=6)
Tsc/mui-docs 2.323Gi ± 7% 2.203Gi ± 5% ~ (p=0.240 n=6)
geomean 2.280Gi 2.229Gi -2.21%
│ old.txt │ new.txt │
│ heap-B │ heap-B vs base │
Tsc/bluesky 915.1Mi ± 0% 914.7Mi ± 0% ~ (p=0.132 n=6)
Tsc/sentry 2.483Gi ± 0% 2.481Gi ± 0% ~ (p=0.065 n=6)
Tsc/t3code-server 2.179Gi ± 0% 2.179Gi ± 0% ~ (p=0.589 n=6)
Tsc/mui-docs 1.722Gi ± 0% 1.634Gi ± 0% -5.16% (p=0.002 n=6)
geomean 1.699Gi 1.676Gi -1.35%
vscode is unaffected (n=12):
│ old │ new │
│ sec/op │ sec/op vs base │
Tsc/vscode 11.71 ± 1% 11.67 ± 2% ~ (p=0.899 n=12)
│ old │ new │
│ rss-B │ rss-B vs base │
Tsc/vscode 4.765Gi ± 1% 4.787Gi ± 1% ~ (p=0.443 n=12)
│ old │ new │
│ heap-B │ heap-B vs base │
Tsc/vscode 3.977Gi ± 0% 3.976Gi ± 0% ~ (p=1.000 n=12)
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow guard preserves signature results and deferred property resolution, with only a nonblocking regression-test suggestion.
1 open issue
What changed in this PR
Avoids resolving mapped-type properties when the native TypeScript checker only needs call or construct signatures.
Changes:
- Returns empty signatures for unresolved mapped types.
- Adds a guard matching the existing member-resolution dispatch.
| File | Description |
|---|---|
| tsc/internal/checker/checker.go | Skips unnecessary mapped-type member resolution during signature queries. |
Review effort: Balanced
|
|
||
| func (c *Checker) getSignaturesOfStructuredType(t *Type, kind SignatureKind) []*Signature { | ||
| if t.flags&TypeFlagsStructuredType == 0 { | ||
| if t.flags&TypeFlagsStructuredType == 0 || isUnresolvedMappedType(t) { |
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.

Mapped types never have call or construct signatures, but asking for their signatures resolved all of their properties. Signature checks in relations ask for them first, so every mapped type that reached a relation had its properties built, even when nothing else needed them. In MUI, components accept
Partial<...>of each intrinsic element's props, so this built hundreds of properties for each of thousands of such types, and their combined base properties too.Measured with --checkers 4 (n=6):