Skip to content

Tweak co/contra inference logic from #52123 - #52180

Merged
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:wtf-bug
Jan 11, 2023
Merged

Tweak co/contra inference logic from #52123 #52180
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:wtf-bug

Conversation

@jakebailey

@jakebaileyJake Bailey (jakebailey) commented Jan 10, 2023

Copy link
Copy Markdown
Member

Fixes#52179

In the case of coAndContraVariantInferences4, we end up with Modifier as the covariant type, but that isn't a subtype of both Modifier and Decorator, so it shouldn't be chosen; we instead want Node, the contravariant inference. But, if you flip things and test for Decorator instead, Modifier is still the covariant inference, but now it doesn't match Decorator, so we get the desired result, Node.

This tweaks the logic from #52123 by ensuring that even the current inference's candidates are checked against the inferred covariant type; this effectively removes the problematic choice for the covariant type produced via union ordering.

I'm not an expert; maybe the better win is to change getCovariantInference somehow. I just tried this and was surprised that it fixed all of my examples and broke no other test.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the diff-based top-repos suite on this PR at 22cfe3a. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the extended test suite on this PR at 22cfe3a. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the diff-based user code test suite on this PR at 22cfe3a. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the parallelized Definitely Typed test suite on this PR at 22cfe3a. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the perf test suite on this PR at 22cfe3a. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the tarball bundle task on this PR at 22cfe3a. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/142189/artifacts?artifactName=tgz&fileId=5C918491703160B0BD60CA07F72F23EC792D3F9FCF3796D6F854B45B5D1D5DBB02&fileName=/typescript-5.0.0-insiders.20230110.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-52180-7".;

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user test suite comparing main and refs/pull/52180/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top-repos suite comparing main and refs/pull/52180/merge:

Everything looks good!

@jakebailey

Jake Bailey (jakebailey) commented Jan 10, 2023

Copy link
Copy Markdown
MemberAuthor

This PR turns out to only fix some of the examples in the linked issue.

@ahejlsberg

Copy link
Copy Markdown
Member

Interesting situation... Co-variant inferences have no common supertype, so we pick the first in anticipation of an error being issued as a result. However, we could have succeeded by picking the contra-variant inference. Yup, we could do better here. I like your proposed fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved assuming performance is unaffected and tests are clean.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

All user/top100/etc tests are clean; waiting on perf tests though since I have to merge a fix to main first to unblock it.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the tarball bundle task on this PR at 60e15f3. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the perf test suite on this PR at 60e15f3. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/142306/artifacts?artifactName=tgz&fileId=DE14D7E5D5144BBF8161195011F7CE0E54DD6AD8CCDBF5897C9F72065FC0856902&fileName=/typescript-5.0.0-insiders.20230111.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-52180-17".;

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Just tested this on #49929 and it works really well; even more cases I didn't notice are fixed, including inference I worked around with this:

functioncastToNodeArray<TextendsNode>(nodes: readonlyT[]): NodeArray<T>{returncast<NodeArray<T>,readonlyT[]>(nodes,isNodeArray);}

I'll add these newly found examples as test cases here.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Nah, nevermind; forgot that it was to do with the fact that I had to change cast's signature until #52123, so the above code was already not needed even before this PR, which is more about the union thing when there's ambiguity.

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Here they are:

Compiler

Comparison Report - main..52180
Metricmain52180DeltaBestWorst
Angular - node (v18.10.0, x64)
Memory used372,660k (± 0.01%)372,420k (± 0.01%)-240k (- 0.06%)372,342k372,484k
Parse Time3.93s (± 0.82%)3.95s (± 1.07%)+0.01s (+ 0.34%)3.91s4.02s
Bind Time1.20s (± 0.39%)1.21s (± 0.52%)+0.00s (+ 0.14%)1.20s1.21s
Check Time8.60s (± 0.43%)8.64s (± 0.44%)+0.04s (+ 0.45%)8.58s8.67s
Emit Time7.50s (± 0.37%)7.57s (± 1.29%)+0.06s (+ 0.85%)7.47s7.75s
Total Time21.24s (± 0.18%)21.36s (± 0.73%)+0.12s (+ 0.56%)21.21s21.64s
Compiler-Unions - node (v18.10.0, x64)
Memory used202,113k (± 1.43%)201,226k (± 1.55%)-887k (- 0.44%)198,348k204,223k
Parse Time1.66s (± 1.58%)1.64s (± 1.73%)-0.02s (- 1.47%)1.60s1.67s
Bind Time0.79s (± 0.15%)0.79s (± 0.40%)+0.00s (+ 0.14%)0.79s0.80s
Check Time9.47s (± 1.14%)9.49s (± 0.55%)+0.02s (+ 0.20%)9.42s9.54s
Emit Time2.76s (± 0.65%)2.74s (± 0.74%)-0.02s (- 0.61%)2.71s2.76s
Total Time14.68s (± 0.66%)14.66s (± 0.54%)-0.03s (- 0.19%)14.55s14.75s
Monaco - node (v18.10.0, x64)
Memory used354,119k (± 0.01%)354,151k (± 0.01%)+32k (+ 0.01%)354,098k354,181k
Parse Time2.93s (± 0.59%)2.95s (± 0.72%)+0.02s (+ 0.77%)2.92s2.97s
Bind Time1.04s (± 0.82%)1.04s (± 1.15%)+0.00s (+ 0.03%)1.03s1.06s
Check Time7.24s (± 0.43%)7.23s (± 0.70%)-0.01s (- 0.08%)7.16s7.29s
Emit Time4.27s (± 0.98%)4.30s (± 1.31%)+0.02s (+ 0.58%)4.24s4.40s
Total Time15.48s (± 0.41%)15.52s (± 0.67%)+0.04s (+ 0.27%)15.41s15.70s
TFS - node (v18.10.0, x64)
Memory used310,022k (± 0.01%)310,193k (± 0.01%)+171k (+ 0.06%)310,178k310,228k
Parse Time2.26s (± 0.50%)2.27s (± 1.01%)+0.01s (+ 0.53%)2.23s2.30s
Bind Time1.16s (± 0.53%)1.15s (± 0.75%)-0.01s (- 1.13%)1.13s1.16s
Check Time6.79s (± 0.62%)6.80s (± 0.71%)+0.01s (+ 0.16%)6.72s6.85s
Emit Time3.93s (± 0.71%)3.94s (± 0.55%)+0.01s (+ 0.16%)3.91s3.96s
Total Time14.14s (± 0.50%)14.16s (± 0.58%)+0.02s (+ 0.13%)14.01s14.22s
material-ui - node (v18.10.0, x64)
Memory used485,241k (± 0.02%)485,287k (± 0.02%)+46k (+ 0.01%)485,215k485,396k
Parse Time3.54s (± 0.68%)3.53s (± 0.35%)-0.01s (- 0.30%)3.51s3.55s
Bind Time0.97s (± 0.93%)0.96s (± 1.29%)-0.01s (- 0.58%)0.95s0.98s
Check Time16.91s (± 0.16%)16.88s (± 0.23%)-0.04s (- 0.21%)16.82s16.93s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time21.42s (± 0.19%)21.37s (± 0.20%)-0.05s (- 0.24%)21.30s21.43s
xstate - node (v18.10.0, x64)
Memory used570,346k (± 0.03%)570,343k (± 0.01%)-3k (- 0.00%)570,261k570,438k
Parse Time4.42s (± 0.41%)4.43s (± 0.79%)+0.01s (+ 0.25%)4.39s4.48s
Bind Time1.69s (± 0.80%)1.71s (± 0.93%)+0.01s (+ 0.75%)1.68s1.73s
Check Time2.61s (± 1.20%)2.61s (± 1.20%)+0.01s (+ 0.19%)2.58s2.65s
Emit Time0.08s (± 0.18%)0.08s (± 0.10%)+0.00s (+ 0.07%)0.08s0.08s
Total Time8.81s (± 0.38%)8.83s (± 0.28%)+0.02s (+ 0.20%)8.78s8.85s
Angular - node (v16.17.1, x64)
Memory used372,012k (± 0.01%)371,785k (± 0.01%)-227k (- 0.06%)371,747k371,828k
Parse Time4.13s (± 0.35%)4.13s (± 0.25%)+0.00s (+ 0.09%)4.12s4.15s
Bind Time1.27s (± 0.77%)1.27s (± 0.42%)+0.00s (+ 0.00%)1.26s1.27s
Check Time9.31s (± 0.27%)9.32s (± 0.25%)+0.01s (+ 0.08%)9.29s9.35s
Emit Time7.98s (± 0.21%)8.01s (± 0.30%)+0.03s (+ 0.40%)7.98s8.05s
Total Time22.68s (± 0.17%)22.72s (± 0.19%)+0.04s (+ 0.18%)22.67s22.79s
Compiler-Unions - node (v16.17.1, x64)
Memory used200,472k (± 0.68%)199,930k (± 0.04%)-542k (- 0.27%)199,786k200,011k
Parse Time1.80s (± 1.52%)1.80s (± 0.59%)+0.00s (+ 0.22%)1.78s1.81s
Bind Time0.84s (± 0.80%)0.84s (± 0.52%)+0.00s (+ 0.43%)0.84s0.85s
Check Time10.09s (± 1.04%)10.10s (± 0.44%)+0.01s (+ 0.05%)10.04s10.14s
Emit Time3.04s (± 4.21%)3.06s (± 4.16%)+0.01s (+ 0.42%)2.97s3.31s
Total Time15.77s (± 1.49%)15.79s (± 0.99%)+0.02s (+ 0.14%)15.70s16.11s
Monaco - node (v16.17.1, x64)
Memory used353,418k (± 0.01%)353,440k (± 0.01%)+22k (+ 0.01%)353,402k353,497k
Parse Time3.16s (± 0.88%)3.15s (± 0.53%)-0.01s (- 0.30%)3.13s3.17s
Bind Time1.12s (± 0.85%)1.12s (± 0.83%)+0.00s (+ 0.26%)1.11s1.13s
Check Time7.86s (± 0.58%)7.83s (± 0.48%)-0.03s (- 0.33%)7.78s7.86s
Emit Time4.50s (± 0.48%)4.50s (± 0.61%)+0.00s (+ 0.04%)4.47s4.54s
Total Time16.64s (± 0.41%)16.61s (± 0.28%)-0.03s (- 0.18%)16.53s16.66s
TFS - node (v16.17.1, x64)
Memory used309,375k (± 0.00%)309,554k (± 0.01%)+180k (+ 0.06%)309,537k309,575k
Parse Time2.63s (± 1.20%)2.66s (± 1.50%)+0.03s (+ 1.19%)2.61s2.71s
Bind Time1.06s (± 1.93%)1.05s (± 2.43%)-0.01s (- 1.23%)1.02s1.10s
Check Time7.42s (± 0.48%)7.38s (± 0.52%)-0.03s (- 0.47%)7.34s7.44s
Emit Time4.23s (± 0.48%)4.23s (± 0.40%)-0.00s (- 0.09%)4.20s4.25s
Total Time15.35s (± 0.33%)15.32s (± 0.23%)-0.02s (- 0.14%)15.28s15.37s
material-ui - node (v16.17.1, x64)
Memory used484,513k (± 0.01%)484,503k (± 0.01%)-10k (- 0.00%)484,449k484,544k
Parse Time3.67s (± 0.29%)3.66s (± 0.11%)-0.01s (- 0.29%)3.66s3.67s
Bind Time1.01s (± 0.72%)1.01s (± 0.56%)-0.00s (- 0.23%)1.00s1.02s
Check Time17.89s (± 0.60%)17.86s (± 0.35%)-0.04s (- 0.20%)17.75s17.92s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time22.58s (± 0.47%)22.53s (± 0.29%)-0.05s (- 0.23%)22.42s22.59s
xstate - node (v16.17.1, x64)
Memory used567,869k (± 0.02%)567,986k (± 0.02%)+117k (+ 0.02%)567,871k568,200k
Parse Time4.74s (± 0.58%)4.75s (± 0.33%)+0.00s (+ 0.08%)4.73s4.77s
Bind Time1.65s (± 0.43%)1.65s (± 0.44%)-0.00s (- 0.27%)1.64s1.66s
Check Time2.84s (± 0.41%)2.83s (± 0.17%)-0.01s (- 0.28%)2.83s2.84s
Emit Time0.09s (± 4.58%)0.08s (± 6.51%)🟩-0.00s (- 3.93%)0.08s0.09s
Total Time9.33s (± 0.44%)9.32s (± 0.24%)-0.01s (- 0.11%)9.30s9.35s
Angular - node (v14.15.1, x64)
Memory used365,695k (± 0.01%)365,439k (± 0.00%)-256k (- 0.07%)365,423k365,457k
Parse Time4.16s (± 0.58%)4.15s (± 0.56%)-0.01s (- 0.25%)4.12s4.19s
Bind Time1.30s (± 0.78%)1.30s (± 1.15%)-0.00s (- 0.19%)1.29s1.33s
Check Time9.67s (± 0.91%)9.67s (± 0.55%)+0.00s (+ 0.01%)9.61s9.74s
Emit Time8.20s (± 0.69%)8.22s (± 0.85%)+0.02s (+ 0.29%)8.13s8.32s
Total Time23.33s (± 0.62%)23.34s (± 0.19%)+0.01s (+ 0.05%)23.28s23.41s
Compiler-Unions - node (v14.15.1, x64)
Memory used195,185k (± 0.02%)195,200k (± 0.02%)+15k (+ 0.01%)195,161k195,242k
Parse Time1.85s (± 0.45%)1.86s (± 1.04%)+0.01s (+ 0.45%)1.83s1.88s
Bind Time0.87s (± 0.94%)0.87s (± 0.60%)-0.00s (- 0.19%)0.87s0.88s
Check Time10.12s (± 0.32%)10.16s (± 0.32%)+0.04s (+ 0.43%)10.12s10.21s
Emit Time3.14s (± 0.68%)3.13s (± 0.82%)-0.01s (- 0.42%)3.09s3.16s
Total Time15.98s (± 0.23%)16.01s (± 0.19%)+0.04s (+ 0.23%)15.98s16.06s
Monaco - node (v14.15.1, x64)
Memory used348,263k (± 0.00%)348,294k (± 0.00%)+31k (+ 0.01%)348,285k348,317k
Parse Time3.24s (± 1.07%)3.28s (± 1.36%)+0.03s (+ 0.94%)3.23s3.34s
Bind Time1.12s (± 0.91%)1.11s (± 0.45%)-0.01s (- 0.77%)1.11s1.12s
Check Time8.15s (± 0.69%)8.18s (± 0.53%)+0.03s (+ 0.33%)8.13s8.24s
Emit Time4.70s (± 0.77%)4.71s (± 0.73%)+0.01s (+ 0.18%)4.67s4.76s
Total Time17.22s (± 0.58%)17.28s (± 0.50%)+0.06s (+ 0.34%)17.20s17.45s
TFS - node (v14.15.1, x64)
Memory used304,280k (± 0.00%)304,471k (± 0.00%)+191k (+ 0.06%)304,460k304,482k
Parse Time2.73s (± 1.20%)2.79s (± 0.88%)+0.05s (+ 1.97%)2.76s2.82s
Bind Time1.09s (± 0.77%)1.10s (± 0.46%)+0.01s (+ 1.19%)1.09s1.11s
Check Time7.73s (± 0.42%)7.72s (± 0.69%)-0.02s (- 0.23%)7.65s7.78s
Emit Time4.60s (± 0.99%)4.59s (± 0.65%)-0.01s (- 0.25%)4.56s4.64s
Total Time16.15s (± 0.58%)16.19s (± 0.30%)+0.04s (+ 0.25%)16.11s16.25s
material-ui - node (v14.15.1, x64)
Memory used479,985k (± 0.01%)479,967k (± 0.01%)-18k (- 0.00%)479,911k480,002k
Parse Time3.89s (± 0.45%)3.91s (± 0.99%)+0.02s (+ 0.46%)3.86s3.96s
Bind Time1.05s (± 0.56%)1.05s (± 0.99%)+0.00s (+ 0.17%)1.04s1.07s
Check Time18.88s (± 0.80%)18.87s (± 0.57%)-0.01s (- 0.03%)18.76s19.03s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time23.82s (± 0.71%)23.83s (± 0.61%)+0.01s (+ 0.03%)23.67s24.05s
xstate - node (v14.15.1, x64)
Memory used556,233k (± 0.01%)556,319k (± 0.00%)+86k (+ 0.02%)556,283k556,343k
Parse Time5.16s (± 1.09%)5.14s (± 0.79%)-0.02s (- 0.35%)5.07s5.19s
Bind Time1.58s (± 0.74%)1.59s (± 0.86%)+0.01s (+ 0.77%)1.58s1.62s
Check Time3.00s (± 0.50%)2.99s (± 0.73%)-0.01s (- 0.46%)2.96s3.02s
Emit Time0.10s (± 0.08%)0.10s (± 0.16%)+0.00s (+ 0.03%)0.10s0.10s
Total Time9.84s (± 0.56%)9.83s (± 0.52%)-0.01s (- 0.14%)9.74s9.90s
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.15.1, x64)
BenchmarkNameIterations
Current521806
Baselinemain6

TSServer

Comparison Report - main..52180
Metricmain52180DeltaBestWorst
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen2,587ms (± 1.64%)2,546ms (± 2.53%)-41ms (- 1.60%)2,467ms2,631ms
Req 2 - geterr5,383ms (± 1.19%)5,356ms (± 1.08%)-26ms (- 0.49%)5,284ms5,427ms
Req 3 - references372ms (± 1.09%)370ms (± 2.49%)-2ms (- 0.48%)359ms379ms
Req 4 - navto317ms (±27.30%)283ms (± 1.91%)🟩-35ms (-10.98%)277ms291ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo265ms (±35.44%)299ms (± 2.00%)+34ms (+12.92%)292ms307ms
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen2,758ms (± 1.08%)2,783ms (± 0.88%)+25ms (+ 0.91%)2,758ms2,813ms
Req 2 - geterr3,955ms (± 0.32%)3,988ms (± 0.61%)+33ms (+ 0.84%)3,959ms4,013ms
Req 3 - references362ms (± 1.51%)361ms (± 0.92%)-1ms (- 0.36%)356ms365ms
Req 4 - navto290ms (± 0.82%)294ms (± 1.56%)+4ms (+ 1.27%)289ms302ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo67ms (± 4.08%)71ms (± 5.52%)+4ms (+ 5.95%)66ms76ms
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen3,387ms (± 0.41%)3,404ms (± 0.58%)+18ms (+ 0.52%)3,373ms3,425ms
Req 2 - geterr1,549ms (± 1.16%)1,549ms (± 1.73%)-0ms (- 0.01%)1,514ms1,580ms
Req 3 - references101ms (± 4.11%)104ms (± 3.72%)+4ms (+ 3.60%)100ms108ms
Req 4 - navto355ms (± 0.92%)362ms (± 1.57%)+6ms (+ 1.73%)353ms367ms
Req 5 - completionInfo count3,154 (± 0.00%)3,154 (± 0.00%)0 ( 0.00%)3,1543,154
Req 5 - completionInfo428ms (± 1.18%)431ms (± 0.63%)+3ms (+ 0.75%)429ms435ms
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen2,786ms (± 0.52%)2,793ms (± 0.45%)+7ms (+ 0.25%)2,775ms2,807ms
Req 2 - geterr5,862ms (± 2.34%)5,842ms (± 2.52%)-21ms (- 0.35%)5,700ms5,999ms
Req 3 - references363ms (± 0.66%)363ms (± 0.70%)-0ms (- 0.01%)359ms365ms
Req 4 - navto391ms (±29.52%)352ms (±31.78%)🟩-40ms (-10.11%)276ms498ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo89ms (± 7.56%)126ms (±75.23%)🔻+38ms (+42.33%)81ms320ms
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen2,934ms (± 0.44%)2,914ms (± 0.39%)-19ms (- 0.66%)2,893ms2,925ms
Req 2 - geterr4,326ms (± 0.48%)4,283ms (± 0.43%)-44ms (- 1.01%)4,248ms4,300ms
Req 3 - references378ms (± 0.58%)378ms (± 0.66%)+0ms (+ 0.11%)375ms381ms
Req 4 - navto302ms (± 0.25%)303ms (± 1.00%)+1ms (+ 0.43%)297ms305ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo317ms (± 0.59%)275ms (±35.18%)🟩-42ms (-13.12%)77ms319ms
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen3,757ms (± 0.59%)3,765ms (± 0.40%)+7ms (+ 0.20%)3,743ms3,786ms
Req 2 - geterr1,448ms (± 0.78%)1,464ms (± 1.15%)+16ms (+ 1.10%)1,442ms1,493ms
Req 3 - references110ms (± 2.17%)108ms (± 3.15%)-2ms (- 2.09%)104ms113ms
Req 4 - navto348ms (± 1.58%)344ms (± 1.16%)-4ms (- 1.25%)337ms350ms
Req 5 - completionInfo count3,154 (± 0.00%)3,154 (± 0.00%)0 ( 0.00%)3,1543,154
Req 5 - completionInfo472ms (± 1.84%)469ms (± 2.25%)-3ms (- 0.65%)456ms483ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen2,877ms (± 0.34%)2,892ms (± 0.62%)+15ms (+ 0.53%)2,868ms2,911ms
Req 2 - geterr6,112ms (± 0.42%)6,171ms (± 0.52%)+58ms (+ 0.96%)6,137ms6,219ms
Req 3 - references379ms (± 0.56%)380ms (± 0.55%)+1ms (+ 0.32%)379ms385ms
Req 4 - navto289ms (± 0.65%)294ms (± 0.76%)+4ms (+ 1.39%)289ms296ms
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)0 ( 0.00%)1,3561,356
Req 5 - completionInfo93ms (± 5.92%)172ms (±70.70%)🔻+79ms (+84.60%)87ms334ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen3,017ms (± 1.07%)3,022ms (± 0.89%)+5ms (+ 0.17%)2,999ms3,072ms
Req 2 - geterr4,585ms (± 0.57%)4,570ms (± 0.67%)-15ms (- 0.32%)4,515ms4,597ms
Req 3 - references402ms (± 0.68%)405ms (± 0.89%)+3ms (+ 0.79%)400ms410ms
Req 4 - navto306ms (± 0.91%)307ms (± 1.21%)+2ms (+ 0.64%)304ms314ms
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)0 ( 0.00%)1,5181,518
Req 5 - completionInfo82ms (± 8.67%)84ms (± 8.91%)+2ms (+ 2.72%)77ms96ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen3,869ms (± 0.89%)3,851ms (± 0.59%)-18ms (- 0.47%)3,815ms3,870ms
Req 2 - geterr1,465ms (± 0.94%)1,457ms (± 0.81%)-8ms (- 0.56%)1,446ms1,479ms
Req 3 - references127ms (± 2.56%)125ms (± 3.47%)-2ms (- 1.55%)120ms130ms
Req 4 - navto395ms (± 0.72%)395ms (± 1.10%)-1ms (- 0.14%)389ms402ms
Req 5 - completionInfo count3,154 (± 0.00%)3,154 (± 0.00%)0 ( 0.00%)3,1543,154
Req 5 - completionInfo496ms (± 1.82%)493ms (± 1.09%)-3ms (- 0.53%)485ms498ms
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.15.1, x64)
BenchmarkNameIterations
Current521806
Baselinemain6

Startup

Comparison Report - main..52180
Metricmain52180DeltaBestWorst
tsc-startup - node (v16.17.1, x64)
Execution time138.97ms (± 0.21%)139.83ms (± 0.25%)+0.86ms (+ 0.62%)138.68ms146.08ms
tsserver-startup - node (v16.17.1, x64)
Execution time230.50ms (± 0.25%)231.81ms (± 0.34%)+1.31ms (+ 0.57%)229.40ms239.07ms
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time233.18ms (± 0.24%)234.29ms (± 0.28%)+1.10ms (+ 0.47%)232.30ms241.27ms
typescript-startup - node (v16.17.1, x64)
Execution time215.36ms (± 0.22%)215.60ms (± 0.26%)+0.24ms (+ 0.11%)213.35ms221.94ms
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
BenchmarkNameIterations
Current521806
Baselinemain6

Developer Information:

Download Benchmark

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Perf looks the same (normal noise). Thanks for the review!

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

Labels

Author: TeamFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type parameter on ts.some/ts.find is too narrow when called on union of arrays, works with explicit instantiation

3 participants

@jakebailey@typescript-bot@ahejlsberg