Skip to content

Properly instantiate inferred constraints in conditional types - #42747

Merged
Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
fix42636
Mar 5, 2021
Merged

Properly instantiate inferred constraints in conditional types#42747
Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
fix42636

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes#42636.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the abridged perf test suite on this PR at 9f93e38. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the extended test suite on this PR at 9f93e38. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at 9f93e38. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized community code test suite on this PR at 9f93e38. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the perf test suite on this PR at 9f93e38. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg)
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..42747

Metricmaster42747DeltaBestWorst
Angular - node (v14.15.1, x64)
Memory used321,824k (± 0.01%)321,843k (± 0.00%)+20k (+ 0.01%)321,806k321,870k
Parse Time1.91s (± 0.59%)1.90s (± 0.47%)-0.01s (- 0.26%)1.89s1.92s
Bind Time0.84s (± 0.58%)0.84s (± 0.79%)-0.00s (- 0.12%)0.83s0.86s
Check Time4.83s (± 0.52%)4.86s (± 0.57%)+0.02s (+ 0.48%)4.79s4.91s
Emit Time5.47s (± 0.77%)5.50s (± 0.50%)+0.02s (+ 0.38%)5.42s5.55s
Total Time13.06s (± 0.43%)13.10s (± 0.43%)+0.03s (+ 0.27%)12.95s13.20s
Compiler-Unions - node (v14.15.1, x64)
Memory used200,409k (± 0.60%)200,569k (± 0.47%)+160k (+ 0.08%)199,676k202,956k
Parse Time0.80s (± 0.62%)0.80s (± 0.84%)+0.00s (+ 0.13%)0.79s0.82s
Bind Time0.53s (± 0.89%)0.53s (± 0.56%)+0.00s (+ 0.38%)0.53s0.54s
Check Time9.70s (± 0.68%)9.70s (± 0.68%)+0.00s (+ 0.02%)9.61s9.89s
Emit Time2.34s (± 1.19%)2.34s (± 1.56%)-0.00s (- 0.13%)2.28s2.44s
Total Time13.37s (± 0.58%)13.37s (± 0.53%)-0.00s (- 0.01%)13.26s13.52s
Monaco - node (v14.15.1, x64)
Memory used336,867k (± 0.01%)336,850k (± 0.01%)-17k (- 0.01%)336,802k336,885k
Parse Time1.57s (± 0.90%)1.56s (± 0.98%)-0.01s (- 0.57%)1.53s1.60s
Bind Time0.73s (± 0.81%)0.73s (± 0.55%)-0.00s (- 0.41%)0.72s0.74s
Check Time4.87s (± 0.79%)4.86s (± 0.28%)-0.01s (- 0.27%)4.84s4.89s
Emit Time2.94s (± 0.66%)2.92s (± 0.97%)-0.01s (- 0.44%)2.89s3.00s
Total Time10.11s (± 0.55%)10.07s (± 0.23%)-0.03s (- 0.34%)10.01s10.12s
TFS - node (v14.15.1, x64)
Memory used291,521k (± 0.01%)291,526k (± 0.01%)+6k (+ 0.00%)291,500k291,595k
Parse Time1.26s (± 1.75%)1.25s (± 2.37%)-0.01s (- 0.79%)1.22s1.36s
Bind Time0.70s (± 0.71%)0.69s (± 0.75%)-0.01s (- 0.72%)0.68s0.70s
Check Time4.49s (± 0.61%)4.46s (± 0.41%)-0.03s (- 0.58%)4.42s4.50s
Emit Time3.03s (± 0.76%)3.04s (± 0.85%)+0.00s (+ 0.03%)2.99s3.09s
Total Time9.48s (± 0.34%)9.44s (± 0.59%)-0.04s (- 0.42%)9.32s9.62s
material-ui - node (v14.15.1, x64)
Memory used471,508k (± 0.00%)471,280k (± 0.07%)-228k (- 0.05%)470,329k471,602k
Parse Time2.05s (± 0.59%)2.07s (± 0.58%)+0.01s (+ 0.58%)2.05s2.09s
Bind Time0.70s (± 0.79%)0.70s (± 0.79%)+0.00s (+ 0.00%)0.69s0.71s
Check Time12.52s (± 0.66%)12.63s (± 0.80%)+0.12s (+ 0.92%)12.46s12.92s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.28s (± 0.50%)15.40s (± 0.69%)+0.12s (+ 0.81%)15.24s15.72s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-198-generic
Architecturex64
Available Memory16 GB
Available Memory7 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4274710
Baselinemaster10

@typescript-bot

Copy link
Copy Markdown
Contributor

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg)
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..42747

Metricmaster42747DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used345,647k (± 0.03%)345,692k (± 0.02%)+45k (+ 0.01%)345,538k345,844k
Parse Time1.93s (± 0.51%)1.91s (± 0.49%)-0.02s (- 0.98%)1.89s1.93s
Bind Time0.83s (± 0.40%)0.82s (± 0.85%)-0.01s (- 1.08%)0.81s0.84s
Check Time4.98s (± 0.42%)4.95s (± 0.37%)-0.02s (- 0.46%)4.92s4.99s
Emit Time5.31s (± 0.56%)5.28s (± 0.85%)-0.03s (- 0.53%)5.21s5.41s
Total Time13.04s (± 0.27%)12.97s (± 0.36%)-0.07s (- 0.57%)12.89s13.07s
Compiler-Unions - node (v10.16.3, x64)
Memory used214,405k (± 0.06%)214,471k (± 0.04%)+65k (+ 0.03%)214,289k214,737k
Parse Time0.78s (± 0.74%)0.78s (± 0.63%)-0.00s (- 0.51%)0.77s0.79s
Bind Time0.50s (± 1.48%)0.50s (± 0.89%)-0.00s (- 0.20%)0.49s0.51s
Check Time10.73s (± 0.65%)10.73s (± 0.96%)0.00s ( 0.00%)10.51s11.00s
Emit Time2.35s (± 1.11%)2.33s (± 1.76%)-0.02s (- 0.72%)2.25s2.43s
Total Time14.36s (± 0.53%)14.34s (± 0.89%)-0.02s (- 0.15%)14.10s14.72s
Monaco - node (v10.16.3, x64)
Memory used355,172k (± 0.03%)355,268k (± 0.02%)+96k (+ 0.03%)355,058k355,432k
Parse Time1.56s (± 0.77%)1.55s (± 0.52%)-0.01s (- 0.32%)1.53s1.56s
Bind Time0.72s (± 0.92%)0.72s (± 0.86%)-0.00s (- 0.28%)0.71s0.74s
Check Time5.11s (± 0.70%)5.10s (± 0.69%)-0.01s (- 0.22%)5.01s5.15s
Emit Time2.80s (± 0.81%)2.82s (± 0.60%)+0.02s (+ 0.64%)2.77s2.85s
Total Time10.19s (± 0.59%)10.19s (± 0.45%)+0.00s (+ 0.01%)10.09s10.27s
TFS - node (v10.16.3, x64)
Memory used308,150k (± 0.02%)308,135k (± 0.02%)-15k (- 0.00%)308,032k308,244k
Parse Time1.21s (± 0.69%)1.21s (± 0.63%)0.00s ( 0.00%)1.19s1.22s
Bind Time0.68s (± 0.44%)0.68s (± 0.76%)-0.00s (- 0.15%)0.67s0.69s
Check Time4.62s (± 0.44%)4.59s (± 0.43%)-0.03s (- 0.65%)4.56s4.64s
Emit Time2.94s (± 0.81%)2.94s (± 0.97%)-0.00s (- 0.10%)2.87s3.00s
Total Time9.46s (± 0.50%)9.42s (± 0.50%)-0.03s (- 0.34%)9.32s9.54s
material-ui - node (v10.16.3, x64)
Memory used495,556k (± 0.02%)495,495k (± 0.01%)-61k (- 0.01%)495,411k495,626k
Parse Time1.99s (± 0.65%)1.96s (± 0.55%)-0.03s (- 1.61%)1.94s1.99s
Bind Time0.65s (± 0.75%)0.65s (± 0.34%)-0.00s (- 0.46%)0.65s0.66s
Check Time13.97s (± 0.65%)14.07s (± 0.66%)+0.10s (+ 0.74%)13.88s14.23s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.62s (± 0.54%)16.69s (± 0.57%)+0.07s (+ 0.42%)16.49s16.87s
Angular - node (v12.1.0, x64)
Memory used323,118k (± 0.08%)323,068k (± 0.09%)-49k (- 0.02%)321,892k323,382k
Parse Time1.92s (± 0.42%)1.91s (± 0.47%)-0.01s (- 0.36%)1.89s1.93s
Bind Time0.80s (± 1.21%)0.80s (± 0.91%)-0.00s (- 0.37%)0.78s0.81s
Check Time4.90s (± 1.16%)4.86s (± 0.66%)-0.04s (- 0.90%)4.82s4.96s
Emit Time5.49s (± 1.15%)5.45s (± 1.00%)-0.04s (- 0.76%)5.35s5.58s
Total Time13.11s (± 0.77%)13.02s (± 0.50%)-0.10s (- 0.74%)12.92s13.21s
Compiler-Unions - node (v12.1.0, x64)
Memory used199,870k (± 0.06%)199,934k (± 0.07%)+64k (+ 0.03%)199,471k200,093k
Parse Time0.77s (± 0.91%)0.77s (± 0.95%)-0.00s (- 0.13%)0.75s0.79s
Bind Time0.50s (± 0.80%)0.50s (± 0.95%)+0.00s (+ 0.40%)0.49s0.51s
Check Time9.79s (± 0.91%)9.80s (± 1.03%)+0.01s (+ 0.08%)9.56s10.01s
Emit Time2.37s (± 1.38%)2.38s (± 1.61%)+0.01s (+ 0.42%)2.28s2.47s
Total Time13.43s (± 0.68%)13.44s (± 0.92%)+0.02s (+ 0.14%)13.17s13.68s
Monaco - node (v12.1.0, x64)
Memory used337,482k (± 0.02%)337,536k (± 0.02%)+53k (+ 0.02%)337,311k337,760k
Parse Time1.53s (± 0.63%)1.53s (± 1.14%)-0.01s (- 0.33%)1.48s1.56s
Bind Time0.71s (± 1.33%)0.70s (± 0.32%)-0.01s (- 1.13%)0.69s0.70s
Check Time4.91s (± 0.35%)4.89s (± 0.50%)-0.02s (- 0.39%)4.84s4.94s
Emit Time2.86s (± 0.83%)2.85s (± 1.12%)-0.01s (- 0.52%)2.80s2.95s
Total Time10.02s (± 0.31%)9.97s (± 0.54%)-0.05s (- 0.49%)9.88s10.10s
TFS - node (v12.1.0, x64)
Memory used292,314k (± 0.02%)292,354k (± 0.03%)+39k (+ 0.01%)292,193k292,578k
Parse Time1.23s (± 0.87%)1.23s (± 0.77%)+0.00s (+ 0.16%)1.21s1.25s
Bind Time0.66s (± 0.84%)0.66s (± 1.05%)-0.00s (- 0.46%)0.64s0.67s
Check Time4.52s (± 0.37%)4.50s (± 0.86%)-0.02s (- 0.38%)4.46s4.62s
Emit Time2.94s (± 0.79%)2.92s (± 0.84%)-0.02s (- 0.85%)2.85s2.98s
Total Time9.34s (± 0.43%)9.30s (± 0.57%)-0.04s (- 0.44%)9.20s9.44s
material-ui - node (v12.1.0, x64)
Memory used472,832k (± 0.01%)472,809k (± 0.01%)-23k (- 0.00%)472,699k472,964k
Parse Time2.00s (± 0.24%)2.00s (± 0.45%)+0.00s (+ 0.10%)1.99s2.03s
Bind Time0.65s (± 0.73%)0.64s (± 0.87%)-0.01s (- 0.77%)0.63s0.65s
Check Time12.59s (± 0.85%)12.65s (± 0.87%)+0.06s (+ 0.51%)12.44s12.87s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.24s (± 0.72%)15.31s (± 0.75%)+0.06s (+ 0.41%)15.07s15.51s
Angular - node (v14.15.1, x64)
Memory used321,824k (± 0.01%)321,830k (± 0.01%)+6k (+ 0.00%)321,799k321,906k
Parse Time1.91s (± 0.59%)1.91s (± 0.76%)-0.00s (- 0.10%)1.88s1.95s
Bind Time0.84s (± 0.58%)0.84s (± 0.69%)-0.00s (- 0.12%)0.83s0.86s
Check Time4.83s (± 0.52%)4.83s (± 0.33%)-0.00s (- 0.06%)4.79s4.86s
Emit Time5.47s (± 0.77%)5.50s (± 0.43%)+0.03s (+ 0.47%)5.44s5.55s
Total Time13.06s (± 0.43%)13.08s (± 0.27%)+0.01s (+ 0.11%)13.00s13.14s
Compiler-Unions - node (v14.15.1, x64)
Memory used200,409k (± 0.60%)200,169k (± 0.52%)-240k (- 0.12%)199,056k202,939k
Parse Time0.80s (± 0.62%)0.80s (± 0.84%)+0.00s (+ 0.13%)0.79s0.82s
Bind Time0.53s (± 0.89%)0.53s (± 0.76%)-0.00s (- 0.19%)0.52s0.54s
Check Time9.70s (± 0.68%)9.76s (± 0.73%)+0.06s (+ 0.64%)9.64s9.90s
Emit Time2.34s (± 1.19%)2.34s (± 1.91%)-0.01s (- 0.21%)2.28s2.46s
Total Time13.37s (± 0.58%)13.42s (± 0.72%)+0.06s (+ 0.43%)13.27s13.68s
Monaco - node (v14.15.1, x64)
Memory used336,867k (± 0.01%)336,865k (± 0.01%)-3k (- 0.00%)336,823k336,938k
Parse Time1.57s (± 0.90%)1.56s (± 0.44%)-0.01s (- 0.64%)1.54s1.57s
Bind Time0.73s (± 0.81%)0.73s (± 0.67%)-0.00s (- 0.00%)0.72s0.74s
Check Time4.87s (± 0.79%)4.84s (± 0.76%)-0.04s (- 0.74%)4.80s4.98s
Emit Time2.94s (± 0.66%)2.91s (± 0.49%)-0.03s (- 0.99%)2.87s2.93s
Total Time10.11s (± 0.55%)10.03s (± 0.44%)-0.07s (- 0.71%)9.96s10.19s
TFS - node (v14.15.1, x64)
Memory used291,521k (± 0.01%)291,529k (± 0.01%)+9k (+ 0.00%)291,486k291,568k
Parse Time1.26s (± 1.75%)1.26s (± 1.71%)-0.01s (- 0.48%)1.22s1.32s
Bind Time0.70s (± 0.71%)0.69s (± 0.68%)-0.01s (- 0.86%)0.68s0.70s
Check Time4.49s (± 0.61%)4.50s (± 0.50%)+0.01s (+ 0.16%)4.44s4.56s
Emit Time3.03s (± 0.76%)3.02s (± 0.55%)-0.01s (- 0.33%)2.98s3.05s
Total Time9.48s (± 0.34%)9.47s (± 0.31%)-0.02s (- 0.16%)9.40s9.52s
material-ui - node (v14.15.1, x64)
Memory used471,508k (± 0.00%)471,488k (± 0.01%)-20k (- 0.00%)471,428k471,532k
Parse Time2.05s (± 0.59%)2.06s (± 0.37%)+0.00s (+ 0.10%)2.04s2.07s
Bind Time0.70s (± 0.79%)0.70s (± 1.00%)-0.00s (- 0.14%)0.69s0.72s
Check Time12.52s (± 0.66%)12.61s (± 0.66%)+0.09s (+ 0.71%)12.50s12.88s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.28s (± 0.50%)15.37s (± 0.53%)+0.09s (+ 0.58%)15.28s15.64s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-198-generic
Architecturex64
Available Memory16 GB
Available Memory7 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4274710
Baselinemaster10

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

Labels

Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Generic with type inference in conditional type not evaluated into definitive type

4 participants

@ahejlsberg@typescript-bot@weswigham@sandersn