Skip to content

Unwrap substitution types early in getPropertyTypeForIndexType - #57113

Closed
Mateusz Burzyński (Andarist) wants to merge 6 commits into
microsoft:mainfrom
Andarist:fix/avoid-redundant-substitution-types
Closed

Unwrap substitution types early in getPropertyTypeForIndexType#57113
Mateusz Burzyński (Andarist) wants to merge 6 commits into
microsoft:mainfrom
Andarist:fix/avoid-redundant-substitution-types

Conversation

@Andarist

@AndaristMateusz Burzyński (Andarist) commented Jan 21, 2024

Copy link
Copy Markdown
Contributor

fixes#57109
fixes#54886

@typescript-botTypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jan 21, 2024
Comment threadsrc/compiler/checker.ts Outdated
@AndaristMateusz Burzyński (Andarist) changed the title Avoid creating redundant substitution types in non-generic contextsUnwrap substitution types early in getPropertyTypeForIndexTypeJun 27, 2024
@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 27, 2024

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started✅ Results
perf test this faster✅ Started👀 Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/57113/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used192,803k (± 0.75%)193,802k (± 0.95%)~192,109k195,760kp=0.630 n=6
Parse Time1.30s (± 0.79%)1.30s (± 1.06%)~1.29s1.32sp=0.799 n=6
Bind Time0.71s (± 0.57%)0.71s~~~p=0.405 n=6
Check Time9.45s (± 0.47%)9.46s (± 0.94%)~9.40s9.63sp=0.469 n=6
Emit Time2.74s (± 0.54%)2.75s (± 1.16%)~2.71s2.79sp=0.571 n=6
Total Time14.21s (± 0.35%)14.22s (± 0.68%)~14.12s14.40sp=0.936 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,050407,050~~~p=1.000 n=6
Memory used1,218,375k (± 0.00%)1,218,347k (± 0.01%)~1,218,259k1,218,405kp=0.471 n=6
Parse Time6.67s (± 0.54%)6.66s (± 0.77%)~6.58s6.73sp=1.000 n=6
Bind Time1.86s (± 0.59%)1.86s (± 0.81%)~1.84s1.88sp=0.663 n=6
Check Time30.67s (± 0.48%)30.63s (± 0.23%)~30.54s30.74sp=0.471 n=6
Emit Time13.56s (± 0.39%)13.54s (± 0.32%)~13.47s13.60sp=0.746 n=6
Total Time52.76s (± 0.38%)52.69s (± 0.15%)~52.60s52.80sp=0.230 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,133,0502,133,050~~~p=1.000 n=6
Types926,444926,444~~~p=1.000 n=6
Memory used2,115,455k (± 0.01%)2,115,550k (± 0.00%)~2,115,352k2,115,635kp=0.298 n=6
Parse Time6.66s (± 0.52%)6.62s (± 0.23%)-0.04s (- 0.63%)6.59s6.63sp=0.045 n=6
Bind Time2.34s (± 1.11%)2.30s (± 0.70%)-0.04s (- 1.64%)2.29s2.33sp=0.019 n=6
Check Time70.54s (± 1.23%)70.96s (± 0.48%)~70.37s71.37sp=0.297 n=6
Emit Time0.14s (± 2.95%)0.14s (± 5.69%)~0.13s0.15sp=0.206 n=6
Total Time79.68s (± 1.06%)80.02s (± 0.39%)~79.48s80.40sp=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,231,6401,231,640~~~p=1.000 n=6
Types261,187261,187~~~p=1.000 n=6
Memory used2,347,498k (± 0.06%)2,347,606k (± 0.02%)~2,347,131k2,348,198kp=0.810 n=6
Parse Time5.08s (± 0.99%)5.06s (± 0.89%)~5.01s5.12sp=0.572 n=6
Bind Time1.94s (± 0.97%)1.93s (± 1.01%)~1.90s1.96sp=0.624 n=6
Check Time34.17s (± 0.20%)34.09s (± 0.24%)~33.98s34.21sp=0.173 n=6
Emit Time2.73s (± 3.96%)2.75s (± 2.36%)~2.68s2.83sp=0.335 n=6
Total Time43.92s (± 0.32%)43.83s (± 0.34%)~43.66s44.06sp=0.378 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,231,6401,231,640~~~p=1.000 n=6
Types261,187261,187~~~p=1.000 n=6
Memory used2,425,268k (± 0.06%)2,423,967k (± 0.08%)~2,421,935k2,426,256kp=0.298 n=6
Parse Time7.80s (± 1.00%)7.82s (± 1.27%)~7.70s7.96sp=0.689 n=6
Bind Time2.54s (± 0.99%)2.51s (± 0.92%)~2.49s2.54sp=0.052 n=6
Check Time50.00s (± 0.25%)50.05s (± 0.27%)~49.87s50.21sp=0.521 n=6
Emit Time3.95s (± 4.70%)4.00s (± 2.99%)~3.82s4.12sp=0.423 n=6
Total Time64.31s (± 0.33%)64.40s (± 0.40%)~64.00s64.68sp=0.423 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,818258,818~~~p=1.000 n=6
Types104,842104,842~~~p=1.000 n=6
Memory used428,255k (± 0.01%)428,248k (± 0.01%)~428,222k428,276kp=0.521 n=6
Parse Time3.31s (± 0.30%)3.34s (± 1.33%)~3.27s3.39sp=0.193 n=6
Bind Time1.30s (± 0.63%)1.30s (± 0.63%)~1.29s1.31sp=1.000 n=6
Check Time17.79s (± 0.36%)17.77s (± 0.34%)~17.67s17.81sp=0.936 n=6
Emit Time1.38s (± 1.21%)1.39s (± 1.20%)~1.38s1.42sp=0.616 n=6
Total Time23.78s (± 0.27%)23.80s (± 0.22%)~23.75s23.87sp=1.000 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,565224,565~~~p=1.000 n=6
Types93,73493,734~~~p=1.000 n=6
Memory used369,531k (± 0.03%)369,465k (± 0.03%)~369,395k369,669kp=0.298 n=6
Parse Time2.77s (± 1.11%)2.76s (± 0.81%)~2.74s2.79sp=1.000 n=6
Bind Time1.57s (± 0.70%)1.58s (± 1.09%)~1.56s1.60sp=0.240 n=6
Check Time15.46s (± 0.32%)15.43s (± 0.34%)~15.39s15.53sp=0.145 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.80s (± 0.31%)19.77s (± 0.31%)~19.71s19.88sp=0.422 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,878,6282,878,628~~~p=1.000 n=6
Types975,175975,175~~~p=1.000 n=6
Memory used3,042,138k (± 0.00%)3,042,122k (± 0.00%)~3,042,068k3,042,161kp=0.810 n=6
Parse Time13.51s (± 0.27%)13.54s (± 0.53%)~13.48s13.67sp=0.570 n=6
Bind Time4.18s (± 1.96%)4.15s (± 0.28%)~4.13s4.16sp=1.000 n=6
Check Time72.79s (± 0.30%)72.85s (± 0.24%)~72.66s73.10sp=0.810 n=6
Emit Time23.75s (± 0.38%)23.84s (± 0.73%)~23.58s24.02sp=0.574 n=6
Total Time114.23s (± 0.23%)114.38s (± 0.17%)~114.15s114.68sp=0.422 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used411,577k (± 0.01%)411,560k (± 0.02%)~411,489k411,659kp=0.810 n=6
Parse Time3.83s (± 0.77%)3.83s (± 0.79%)~3.79s3.88sp=0.936 n=6
Bind Time1.69s (± 0.49%)1.70s (± 0.81%)~1.67s1.71sp=0.672 n=6
Check Time16.71s (± 0.24%)16.73s (± 0.35%)~16.63s16.80sp=0.515 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.24s (± 0.10%)22.25s (± 0.32%)~22.13s22.33sp=0.377 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,877k (± 0.06%)462,522k (± 0.05%)~462,335k462,920kp=0.066 n=6
Parse Time3.19s (± 0.54%)3.19s (± 0.79%)~3.16s3.23sp=1.000 n=6
Bind Time1.17s (± 0.35%)1.18s (± 0.99%)~1.17s1.20sp=0.248 n=6
Check Time17.93s (± 0.44%)17.90s (± 0.48%)~17.77s17.98sp=0.686 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.30s (± 0.36%)22.27s (± 0.36%)~22.14s22.35sp=0.809 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/57113/merge:

Everything looks good!

@github-project-automationgithub-project-automationBot moved this from Waiting on reviewers to Done in PR BacklogMar 24, 2026
@typescript-bot

Copy link
Copy Markdown
Contributor

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog BugPRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Literal tested as key of a certain type cannot be used as an index type extends causing string literal can't be used as index

7 participants

@Andarist@jakebailey@typescript-bot@weswigham@ahejlsberg@sandersn@RyanCavanaugh