Conversation

rbuckton

Similar to #50225, this creates a table to handle each potential syntax kind in visitEachChild.

@typescript-bottypescript-bot added Author: Team For Uncommitted BugPR for untriaged, rejected, closed or missing buglabels Aug 10, 2022
@rbucktonrbuckton force-pushed the visitEachChildTable branch from 419d989 to 56c8d67 Compare August 10, 2022 23:35
@rbuckton

@typescript-bot perf test

@typescript-bot

Heya @rbuckton, I've started to run the perf test suite on this PR at 56c8d67. You can monitor the build here.

Update: The results are in!

@typescript-bot

@rbuckton
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - main..50266
Metricmain50266DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used360,469k (± 0.02%)360,554k (± 0.03%)+85k (+ 0.02%)360,368k360,748k
Parse Time2.12s (± 0.46%)2.11s (± 0.57%)-0.01s (- 0.33%)2.08s2.14s
Bind Time0.89s (± 0.38%)0.89s (± 0.82%)-0.00s (- 0.11%)0.88s0.91s
Check Time6.06s (± 0.38%)6.02s (± 0.41%)-0.04s (- 0.59%)5.94s6.06s
Emit Time6.22s (± 0.58%)5.99s (± 0.54%)🟩-0.24s (- 3.78%)5.91s6.06s
Total Time15.30s (± 0.32%)15.02s (± 0.42%)-0.28s (- 1.81%)14.82s15.15s
Compiler-Unions - node (v10.16.3, x64)
Memory used205,560k (± 0.03%)205,725k (± 0.03%)+165k (+ 0.08%)205,609k205,866k
Parse Time0.83s (± 0.98%)0.83s (± 0.67%)-0.01s (- 0.60%)0.82s0.84s
Bind Time0.53s (± 1.05%)0.53s (± 1.04%)+0.00s (+ 0.76%)0.52s0.54s
Check Time7.08s (± 0.63%)7.12s (± 0.41%)+0.04s (+ 0.55%)7.06s7.19s
Emit Time2.53s (± 0.74%)2.45s (± 0.99%)🟩-0.08s (- 3.24%)2.37s2.49s
Total Time10.96s (± 0.47%)10.92s (± 0.34%)-0.04s (- 0.38%)10.85s11.00s
Monaco - node (v10.16.3, x64)
Memory used344,005k (± 0.02%)344,143k (± 0.02%)+138k (+ 0.04%)343,999k344,243k
Parse Time1.61s (± 0.78%)1.62s (± 0.77%)+0.01s (+ 0.31%)1.58s1.63s
Bind Time0.76s (± 0.79%)0.76s (± 1.16%)+0.01s (+ 0.66%)0.75s0.79s
Check Time6.04s (± 0.44%)6.04s (± 0.36%)-0.01s (- 0.12%)6.00s6.09s
Emit Time3.30s (± 0.63%)3.21s (± 0.98%)-0.09s (- 2.61%)3.16s3.28s
Total Time11.70s (± 0.33%)11.62s (± 0.42%)-0.08s (- 0.68%)11.54s11.73s
TFS - node (v10.16.3, x64)
Memory used305,269k (± 0.01%)305,260k (± 0.02%)-8k (- 0.00%)305,099k305,362k
Parse Time1.30s (± 0.58%)1.30s (± 0.65%)+0.00s (+ 0.23%)1.29s1.33s
Bind Time0.73s (± 0.82%)0.73s (± 0.65%)+0.00s (+ 0.14%)0.72s0.74s
Check Time5.47s (± 0.32%)5.46s (± 0.52%)-0.00s (- 0.05%)5.38s5.51s
Emit Time3.47s (± 1.22%)3.40s (± 1.11%)-0.07s (- 1.96%)3.31s3.47s
Total Time10.96s (± 0.47%)10.89s (± 0.54%)-0.07s (- 0.64%)10.73s10.96s
material-ui - node (v10.16.3, x64)
Memory used469,655k (± 0.01%)469,659k (± 0.01%)+4k (+ 0.00%)469,566k469,753k
Parse Time1.85s (± 0.58%)1.86s (± 0.71%)+0.01s (+ 0.49%)1.83s1.89s
Bind Time0.68s (± 1.44%)0.68s (± 1.49%)-0.01s (- 0.88%)0.66s0.70s
Check Time14.69s (± 0.56%)14.75s (± 0.34%)+0.06s (+ 0.39%)14.68s14.91s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time17.22s (± 0.49%)17.28s (± 0.31%)+0.06s (+ 0.37%)17.22s17.45s
xstate - node (v10.16.3, x64)
Memory used578,808k (± 0.01%)578,977k (± 0.02%)+169k (+ 0.03%)578,720k579,221k
Parse Time2.62s (± 0.44%)2.62s (± 0.40%)+0.00s (+ 0.19%)2.60s2.64s
Bind Time1.03s (± 1.20%)1.02s (± 1.49%)-0.00s (- 0.29%)1.01s1.08s
Check Time1.57s (± 0.73%)1.57s (± 0.56%)-0.00s (- 0.19%)1.54s1.58s
Emit Time0.07s (± 0.00%)0.07s (± 0.00%)0.00s ( 0.00%)0.07s0.07s
Total Time5.28s (± 0.43%)5.28s (± 0.36%)-0.01s (- 0.09%)5.25s5.33s
Angular - node (v12.1.0, x64)
Memory used338,132k (± 0.02%)338,223k (± 0.02%)+91k (+ 0.03%)338,037k338,398k
Parse Time2.10s (± 0.72%)2.12s (± 0.62%)+0.02s (+ 0.86%)2.09s2.16s
Bind Time0.85s (± 0.70%)0.86s (± 0.80%)+0.00s (+ 0.23%)0.84s0.87s
Check Time5.87s (± 0.34%)5.86s (± 0.28%)-0.01s (- 0.19%)5.81s5.89s
Emit Time6.43s (± 0.51%)6.23s (± 0.84%)🟩-0.20s (- 3.06%)6.15s6.36s
Total Time15.26s (± 0.33%)15.07s (± 0.34%)-0.19s (- 1.23%)14.96s15.20s
Compiler-Unions - node (v12.1.0, x64)
Memory used193,278k (± 0.06%)193,497k (± 0.03%)+219k (+ 0.11%)193,323k193,574k
Parse Time0.83s (± 0.72%)0.83s (± 0.98%)+0.01s (+ 0.85%)0.82s0.86s
Bind Time0.56s (± 0.65%)0.55s (± 0.66%)-0.00s (- 0.36%)0.55s0.56s
Check Time6.71s (± 0.48%)6.70s (± 0.49%)-0.01s (- 0.07%)6.64s6.79s
Emit Time2.54s (± 1.64%)2.46s (± 1.12%)🟩-0.08s (- 3.26%)2.41s2.55s
Total Time10.63s (± 0.60%)10.54s (± 0.39%)-0.09s (- 0.83%)10.47s10.65s
Monaco - node (v12.1.0, x64)
Memory used326,959k (± 0.03%)327,081k (± 0.03%)+122k (+ 0.04%)326,913k327,304k
Parse Time1.58s (± 1.00%)1.59s (± 0.83%)+0.01s (+ 0.63%)1.56s1.63s
Bind Time0.74s (± 1.00%)0.74s (± 0.66%)+0.00s (+ 0.13%)0.73s0.75s
Check Time5.84s (± 0.38%)5.83s (± 0.46%)-0.01s (- 0.17%)5.77s5.88s
Emit Time3.32s (± 0.68%)3.28s (± 0.75%)-0.04s (- 1.18%)3.22s3.32s
Total Time11.48s (± 0.45%)11.45s (± 0.27%)-0.04s (- 0.31%)11.38s11.51s
TFS - node (v12.1.0, x64)
Memory used289,711k (± 0.06%)289,859k (± 0.02%)+148k (+ 0.05%)289,715k290,038k
Parse Time1.30s (± 0.91%)1.31s (± 0.62%)+0.01s (+ 0.84%)1.30s1.33s
Bind Time0.72s (± 0.83%)0.72s (± 0.86%)+0.00s (+ 0.42%)0.71s0.73s
Check Time5.41s (± 0.66%)5.39s (± 0.53%)-0.02s (- 0.35%)5.35s5.46s
Emit Time3.55s (± 0.83%)3.47s (± 1.17%)-0.07s (- 2.11%)3.36s3.55s
Total Time10.98s (± 0.49%)10.89s (± 0.60%)-0.09s (- 0.78%)10.77s11.05s
material-ui - node (v12.1.0, x64)
Memory used448,714k (± 0.01%)448,314k (± 0.09%)-400k (- 0.09%)447,326k448,763k
Parse Time1.83s (± 0.79%)1.84s (± 0.55%)+0.01s (+ 0.33%)1.81s1.86s
Bind Time0.67s (± 0.86%)0.67s (± 0.54%)+0.00s (+ 0.15%)0.67s0.68s
Check Time13.16s (± 1.08%)13.22s (± 0.50%)+0.06s (+ 0.45%)13.09s13.40s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.66s (± 0.98%)15.73s (± 0.43%)+0.07s (+ 0.41%)15.61s15.91s
xstate - node (v12.1.0, x64)
Memory used544,194k (± 0.02%)544,273k (± 0.01%)+79k (+ 0.01%)544,110k544,407k
Parse Time2.56s (± 0.51%)2.55s (± 0.39%)-0.00s (- 0.08%)2.53s2.57s
Bind Time1.04s (± 1.17%)1.03s (± 0.92%)-0.01s (- 0.48%)1.01s1.05s
Check Time1.51s (± 0.64%)1.51s (± 0.38%)+0.00s (+ 0.13%)1.50s1.53s
Emit Time0.07s (± 0.00%)0.07s (± 0.00%)0.00s ( 0.00%)0.07s0.07s
Total Time5.18s (± 0.38%)5.17s (± 0.41%)-0.01s (- 0.17%)5.13s5.23s
Angular - node (v14.15.1, x64)
Memory used336,308k (± 0.01%)336,385k (± 0.01%)+77k (+ 0.02%)336,302k336,439k
Parse Time2.08s (± 0.85%)2.09s (± 0.82%)+0.01s (+ 0.67%)2.06s2.13s
Bind Time0.90s (± 0.58%)0.90s (± 0.66%)-0.00s (- 0.33%)0.88s0.91s
Check Time5.86s (± 0.42%)5.88s (± 0.29%)+0.02s (+ 0.29%)5.84s5.91s
Emit Time6.39s (± 0.45%)6.20s (± 0.72%)🟩-0.19s (- 3.04%)6.12s6.34s
Total Time15.22s (± 0.18%)15.06s (± 0.47%)-0.17s (- 1.08%)14.92s15.27s
Compiler-Unions - node (v14.15.1, x64)
Memory used191,807k (± 0.01%)192,001k (± 0.01%)+194k (+ 0.10%)191,942k192,057k
Parse Time0.86s (± 0.58%)0.86s (± 0.43%)+0.00s (+ 0.00%)0.85s0.86s
Bind Time0.58s (± 0.51%)0.58s (± 0.69%)+0.00s (+ 0.17%)0.57s0.59s
Check Time6.71s (± 0.70%)6.72s (± 0.53%)+0.02s (+ 0.25%)6.64s6.79s
Emit Time2.50s (± 0.87%)2.42s (± 0.64%)🟩-0.08s (- 3.36%)2.39s2.45s
Total Time10.64s (± 0.57%)10.58s (± 0.36%)-0.06s (- 0.60%)10.50s10.66s
Monaco - node (v14.15.1, x64)
Memory used325,767k (± 0.00%)325,890k (± 0.01%)+123k (+ 0.04%)325,859k325,943k
Parse Time1.58s (± 0.52%)1.59s (± 0.80%)+0.01s (+ 0.57%)1.57s1.62s
Bind Time0.78s (± 0.74%)0.78s (± 0.43%)0.00s ( 0.00%)0.77s0.79s
Check Time5.74s (± 0.31%)5.72s (± 0.61%)-0.02s (- 0.37%)5.61s5.80s
Emit Time3.39s (± 0.68%)3.35s (± 1.24%)-0.04s (- 1.33%)3.28s3.45s
Total Time11.50s (± 0.19%)11.44s (± 0.61%)-0.06s (- 0.52%)11.26s11.58s
TFS - node (v14.15.1, x64)
Memory used288,895k (± 0.01%)288,937k (± 0.01%)+42k (+ 0.01%)288,888k288,990k
Parse Time1.32s (± 1.37%)1.36s (± 2.41%)+0.04s (+ 3.27%)1.29s1.46s
Bind Time0.79s (± 4.56%)0.75s (± 2.74%)🟩-0.04s (- 4.45%)0.73s0.81s
Check Time5.37s (± 0.41%)5.38s (± 0.24%)+0.01s (+ 0.09%)5.35s5.41s
Emit Time3.61s (± 2.11%)3.55s (± 1.68%)-0.06s (- 1.69%)3.39s3.63s
Total Time11.08s (± 0.87%)11.03s (± 0.67%)-0.05s (- 0.45%)10.86s11.18s
material-ui - node (v14.15.1, x64)
Memory used446,647k (± 0.08%)446,935k (± 0.00%)+288k (+ 0.06%)446,881k446,972k
Parse Time1.89s (± 0.60%)1.89s (± 0.32%)-0.00s (- 0.11%)1.88s1.90s
Bind Time0.72s (± 0.97%)0.72s (± 0.83%)+0.01s (+ 0.83%)0.71s0.74s
Check Time13.30s (± 0.99%)13.20s (± 0.66%)-0.09s (- 0.69%)13.03s13.44s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.90s (± 0.84%)15.82s (± 0.55%)-0.09s (- 0.53%)15.64s16.04s
xstate - node (v14.15.1, x64)
Memory used542,004k (± 0.00%)542,157k (± 0.00%)+153k (+ 0.03%)542,106k542,194k
Parse Time2.61s (± 0.34%)2.62s (± 0.43%)+0.01s (+ 0.31%)2.60s2.65s
Bind Time1.16s (± 0.99%)1.17s (± 1.17%)+0.01s (+ 0.69%)1.14s1.20s
Check Time1.56s (± 0.81%)1.56s (± 0.75%)+0.00s (+ 0.06%)1.53s1.58s
Emit Time0.07s (± 3.14%)0.07s (± 4.92%)+0.00s (+ 4.23%)0.07s0.08s
Total Time5.40s (± 0.48%)5.42s (± 0.38%)+0.02s (+ 0.30%)5.36s5.46s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 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)
  • xstate - node (v10.16.3, x64)
  • xstate - node (v12.1.0, x64)
  • xstate - node (v14.15.1, x64)
BenchmarkNameIterations
Current5026610
Baselinemain10

TSServer

Comparison Report - main..50266
Metricmain50266DeltaBestWorst
Compiler-UnionsTSServer - node (v10.16.3, x64)
Req 1 - updateOpen1,464ms (± 0.67%)1,467ms (± 0.63%)+3ms (+ 0.19%)1,452ms1,488ms
Req 2 - geterr3,644ms (± 0.77%)3,642ms (± 0.23%)-2ms (- 0.06%)3,623ms3,664ms
Req 3 - references278ms (± 0.58%)277ms (± 0.59%)-2ms (- 0.58%)274ms281ms
Req 4 - navto232ms (± 0.82%)235ms (± 0.96%)+3ms (+ 1.34%)230ms242ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo62ms (± 4.25%)64ms (± 4.25%)+2ms (+ 2.58%)59ms70ms
CompilerTSServer - node (v10.16.3, x64)
Req 1 - updateOpen1,565ms (± 0.48%)1,566ms (± 0.49%)+1ms (+ 0.06%)1,553ms1,583ms
Req 2 - geterr2,280ms (± 0.31%)2,282ms (± 0.34%)+3ms (+ 0.11%)2,267ms2,300ms
Req 3 - references300ms (± 1.07%)298ms (± 0.83%)-2ms (- 0.63%)292ms302ms
Req 4 - navto233ms (± 2.09%)241ms (± 1.61%)+7ms (+ 3.08%)229ms246ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo68ms (± 3.08%)69ms (± 1.22%)+1ms (+ 0.88%)67ms71ms
xstateTSServer - node (v10.16.3, x64)
Req 1 - updateOpen2,183ms (± 0.42%)2,188ms (± 0.51%)+5ms (+ 0.24%)2,160ms2,210ms
Req 2 - geterr780ms (± 0.51%)777ms (± 0.85%)-3ms (- 0.36%)763ms791ms
Req 3 - references96ms (± 0.79%)97ms (± 0.92%)+0ms (+ 0.21%)95ms98ms
Req 4 - navto255ms (± 0.80%)256ms (± 1.13%)+1ms (+ 0.43%)250ms263ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo274ms (± 1.06%)275ms (± 0.72%)+1ms (+ 0.40%)270ms278ms
Compiler-UnionsTSServer - node (v12.1.0, x64)
Req 1 - updateOpen1,485ms (± 0.68%)1,491ms (± 0.80%)+6ms (+ 0.41%)1,470ms1,521ms
Req 2 - geterr3,410ms (± 0.60%)3,405ms (± 0.88%)-6ms (- 0.16%)3,345ms3,468ms
Req 3 - references265ms (± 0.74%)262ms (± 0.90%)-2ms (- 0.87%)258ms269ms
Req 4 - navto204ms (± 1.06%)206ms (± 1.19%)+2ms (+ 0.83%)201ms210ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo80ms (± 7.95%)87ms (± 4.49%)+7ms (+ 8.59%)80ms95ms
CompilerTSServer - node (v12.1.0, x64)
Req 1 - updateOpen1,574ms (± 0.43%)1,587ms (± 0.64%)+13ms (+ 0.82%)1,571ms1,614ms
Req 2 - geterr2,225ms (± 0.49%)2,231ms (± 0.53%)+7ms (+ 0.30%)2,212ms2,263ms
Req 3 - references274ms (± 0.65%)275ms (± 1.14%)+1ms (+ 0.33%)269ms282ms
Req 4 - navto215ms (± 1.04%)216ms (± 1.06%)+1ms (+ 0.56%)211ms221ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo64ms (± 4.58%)64ms (± 3.63%)-0ms (- 0.31%)58ms67ms
xstateTSServer - node (v12.1.0, x64)
Req 1 - updateOpen2,109ms (± 0.65%)2,115ms (± 0.70%)+7ms (+ 0.32%)2,084ms2,142ms
Req 2 - geterr766ms (± 0.62%)763ms (± 0.78%)-3ms (- 0.38%)747ms771ms
Req 3 - references65ms (± 2.04%)67ms (± 1.34%)+2ms (+ 2.31%)65ms69ms
Req 4 - navto242ms (± 1.19%)243ms (± 0.74%)+1ms (+ 0.41%)239ms246ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo266ms (± 1.33%)266ms (± 0.92%)0ms ( 0.00%)261ms271ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,536ms (± 0.55%)1,541ms (± 0.50%)+5ms (+ 0.30%)1,521ms1,561ms
Req 2 - geterr3,566ms (± 0.48%)3,561ms (± 0.56%)-5ms (- 0.13%)3,518ms3,607ms
Req 3 - references279ms (± 2.40%)277ms (± 0.78%)-2ms (- 0.61%)273ms281ms
Req 4 - navto219ms (± 0.81%)221ms (± 0.81%)+2ms (+ 0.87%)217ms226ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo58ms (± 5.16%)58ms (± 5.13%)0ms ( 0.00%)55ms66ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,612ms (± 0.68%)1,609ms (± 0.51%)-2ms (- 0.15%)1,588ms1,627ms
Req 2 - geterr2,359ms (± 0.42%)2,346ms (± 0.38%)-13ms (- 0.56%)2,325ms2,363ms
Req 3 - references289ms (± 0.96%)288ms (± 0.61%)-1ms (- 0.38%)284ms291ms
Req 4 - navto231ms (± 0.75%)233ms (± 2.06%)+2ms (+ 1.04%)227ms246ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo53ms (± 0.89%)53ms (± 0.84%)-1ms (- 0.94%)52ms54ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen2,223ms (± 0.46%)2,240ms (± 0.47%)+17ms (+ 0.78%)2,224ms2,266ms
Req 2 - geterr782ms (± 0.39%)783ms (± 0.41%)+0ms (+ 0.03%)775ms787ms
Req 3 - references65ms (± 0.93%)65ms (± 0.80%)+1ms (+ 0.93%)64ms66ms
Req 4 - navto252ms (± 0.69%)252ms (± 0.84%)+0ms (+ 0.04%)247ms256ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo268ms (± 0.39%)269ms (± 0.71%)+1ms (+ 0.19%)265ms274ms
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 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
  • Compiler-UnionsTSServer - node (v10.16.3, x64)
  • Compiler-UnionsTSServer - node (v12.1.0, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v10.16.3, x64)
  • CompilerTSServer - node (v12.1.0, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v10.16.3, x64)
  • xstateTSServer - node (v12.1.0, x64)
  • xstateTSServer - node (v14.15.1, x64)
BenchmarkNameIterations
Current5026610
Baselinemain10

Developer Information:

Download Benchmark

@@ -885,6 +885,144 @@ namespace ts {
/* @internal */ jsDocCache?: readonly JSDocTag[]; // Cache for getJSDocTags
}

/* @internal */
export type HasChildren =
Copy link
Member

Choose a reason for hiding this comment

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

I assume that if we need to update this, we'll know because some other code won't be able to compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To add a method to visitEachChild (and potentially forEachChild), we'd have to add the node to this union.

// Names

case SyntaxKind.Identifier:
Debug.type<Identifier>(node);
Copy link
Member

Choose a reason for hiding this comment

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

This is maybe a silly question, but are we sure the perf boost here isn't only because the new code never calls Debug.type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Debug.type() had almost no impact on perf when I added it. It's a noop, so inlining pretty much results in elimination. It definitely wouldn't account for a 3% difference in emit time.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, just checking!

@@ -885,6 +885,144 @@ namespace ts {
/* @internal */ jsDocCache?: readonly JSDocTag[]; // Cache for getJSDocTags
}

/* @internal */
export type HasChildren =
Copy link
Member

Choose a reason for hiding this comment

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

What happens if someone adds a new syntax kind and forgets to update this? Seems like their new node might not emit its children?

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK that's what would have happened in the old code too, because it'd hit the default case to just do nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If both this and #50225 use HasChildren, then you wouldn't be able to define a forEachChild branch or visitEachChild branch without adding an entry, and if you add an entry to HasChildren you would have compile time errors if you forget to add branches to forEachChild and visitEachChild.

@rbucktonrbuckton force-pushed the visitEachChildTable branch from 83b60d7 to 35b5e31 Compare August 11, 2022 19:53
@rbuckton

One more perf test to see if it's worth dropping the early check for tokens in visitEachChild.
@typescript-bot perf test

@typescript-bot

Heya @rbuckton, I've started to run the perf test suite on this PR at 35b5e31. You can monitor the build here.

Update: The results are in!

@@ -378,929 +378,799 @@ namespace ts {
export function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
/* @internal */
export function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: NodesVisitor, tokenVisitor?: Visitor, nodeVisitor?: NodeVisitor): T | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
export function visitEachChild(node: Node | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor = visitNodes, tokenVisitor?: Visitor, nodeVisitor: NodeVisitor = visitNode): Node | undefined {
export function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor = visitNodes, tokenVisitor?: Visitor, nodeVisitor: NodeVisitor = visitNode): T | undefined {

Choose a reason for hiding this comment

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

Isn't the input possibly unrelated to the output? @jakebailey noticed something like this while converting to SFT.

Copy link
Member

@jakebailey jakebailey Aug 11, 2022

Choose a reason for hiding this comment

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

It totally is. In this case, the implementation fails under SFT because it doesn't overlap with its overloads, except that we don't properly check that without SFT which is why this weird narrower implementation works.

Changing the signature to match the overload is totally fine; no worse than what we have now and users won't see the difference. Actual SFT support and a corrected signature will have to come later when we're ready for a break.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm asserting visitEachChildTable[node.kind] as VisitEachChildFunction<T> | undefined. It's difficult to prove this in the type system, but VisitEachChildTable[T["kind"]] should be VisitEachChildFunction<T> | undefined. This isn't perfect, but its better than any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also don't have a great way of expressing the existing overloads in the type system. visitEachChild<BinaryExpressionButWithExtraTypeInfo>(...) would say it produces a BinaryExpressionButWithExtraTypeInfo, but would actually produce a BinaryExpressionButWithExtraTypeInfo | BinaryExpression depending on whether we updated the node. Unless we introduce a big ADT union of all possible Node subtypes, I don't think this can be improved.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, unless I'm mistaken, the transform API is used heavily to completely and entirely replace nodes when visiting with... whatever, even nodes of differing types. So, I would expect that a fixed signature would instead have an overload with a more specific return first, but also a more generic "it's just a node" when the result can't be inferred.

But, that's offtopic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

visitEachChild always returns the same type of node passed as the first argument. You can only update child nodes using the supplied visitor.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, oops, I think Daniel and I are thinking of visitNode and visitNodes, which do have a bogus signature.

Copy link
Contributor Author

@rbuckton rbuckton Aug 11, 2022

Choose a reason for hiding this comment

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

It is and it isn't. visitNode is really supposed to be used with a test parameter, such that you validate the result is a T when visiting a class of nodes such as Statement, Expression, etc. The test is optional, but really shouldn't be. Unfortunately, making test a required argument would probably be a breaking change, and we'd have to expose some of the higher-level node tests (i.e., isStatement, isExpression, isClassElement, etc.) in the public API that are currently internal.

@typescript-bot

@rbuckton
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - main..50266
Metricmain50266DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used360,644k (± 0.02%)360,874k (± 0.02%)+230k (+ 0.06%)360,753k361,089k
Parse Time2.11s (± 0.42%)2.11s (± 0.60%)-0.01s (- 0.47%)2.08s2.14s
Bind Time0.89s (± 0.79%)0.90s (± 0.74%)+0.01s (+ 1.01%)0.88s0.91s
Check Time6.05s (± 0.66%)6.05s (± 0.65%)+0.00s (+ 0.00%)5.98s6.13s
Emit Time6.19s (± 0.86%)6.00s (± 1.05%)🟩-0.19s (- 3.02%)5.89s6.16s
Total Time15.24s (± 0.62%)15.05s (± 0.70%)-0.19s (- 1.23%)14.87s15.29s
Compiler-Unions - node (v10.16.3, x64)
Memory used205,589k (± 0.04%)205,821k (± 0.02%)+232k (+ 0.11%)205,716k205,926k
Parse Time0.84s (± 0.71%)0.84s (± 0.92%)+0.01s (+ 0.60%)0.82s0.86s
Bind Time0.53s (± 1.27%)0.52s (± 1.13%)-0.00s (- 0.57%)0.51s0.54s
Check Time7.11s (± 0.48%)7.12s (± 0.64%)+0.01s (+ 0.17%)6.96s7.19s
Emit Time2.54s (± 1.22%)2.44s (± 1.04%)🟩-0.10s (- 3.86%)2.39s2.49s
Total Time11.02s (± 0.54%)10.93s (± 0.67%)-0.08s (- 0.77%)10.70s11.02s
Monaco - node (v10.16.3, x64)
Memory used344,025k (± 0.02%)344,190k (± 0.02%)+165k (+ 0.05%)344,099k344,358k
Parse Time1.61s (± 0.67%)1.61s (± 0.75%)+0.01s (+ 0.31%)1.58s1.64s
Bind Time0.76s (± 0.66%)0.76s (± 1.32%)+0.01s (+ 1.19%)0.75s0.80s
Check Time6.02s (± 0.49%)6.03s (± 0.38%)+0.01s (+ 0.10%)5.98s6.07s
Emit Time3.28s (± 0.82%)3.24s (± 0.73%)-0.04s (- 1.34%)3.20s3.30s
Total Time11.67s (± 0.43%)11.64s (± 0.26%)-0.03s (- 0.24%)11.55s11.69s
TFS - node (v10.16.3, x64)
Memory used305,302k (± 0.02%)305,332k (± 0.02%)+30k (+ 0.01%)305,182k305,429k
Parse Time1.29s (± 0.31%)1.30s (± 0.64%)+0.01s (+ 0.47%)1.28s1.32s
Bind Time0.72s (± 0.80%)0.73s (± 0.71%)+0.01s (+ 0.83%)0.72s0.74s
Check Time5.46s (± 0.62%)5.47s (± 0.38%)+0.01s (+ 0.15%)5.44s5.55s
Emit Time3.44s (± 1.12%)3.41s (± 1.35%)-0.03s (- 0.96%)3.32s3.49s
Total Time10.92s (± 0.59%)10.90s (± 0.57%)-0.02s (- 0.14%)10.78s11.07s
material-ui - node (v10.16.3, x64)
Memory used469,637k (± 0.02%)469,631k (± 0.01%)-6k (- 0.00%)469,497k469,766k
Parse Time1.84s (± 0.83%)1.84s (± 0.70%)-0.00s (- 0.22%)1.81s1.88s
Bind Time0.69s (± 1.31%)0.70s (± 1.33%)+0.01s (+ 1.01%)0.67s0.71s
Check Time14.67s (± 0.41%)14.73s (± 0.79%)+0.06s (+ 0.40%)14.48s15.09s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time17.21s (± 0.41%)17.27s (± 0.72%)+0.06s (+ 0.35%)16.99s17.65s
xstate - node (v10.16.3, x64)
Memory used578,910k (± 0.02%)578,914k (± 0.01%)+4k (+ 0.00%)578,807k579,039k
Parse Time2.61s (± 0.52%)2.61s (± 0.48%)+0.00s (+ 0.11%)2.58s2.64s
Bind Time1.05s (± 0.80%)1.04s (± 1.06%)-0.01s (- 1.14%)1.01s1.06s
Check Time1.58s (± 0.64%)1.58s (± 0.52%)+0.01s (+ 0.57%)1.56s1.60s
Emit Time0.07s (± 0.00%)0.07s (± 0.00%)0.00s ( 0.00%)0.07s0.07s
Total Time5.30s (± 0.45%)5.30s (± 0.25%)+0.00s (+ 0.09%)5.26s5.32s
Angular - node (v12.1.0, x64)
Memory used338,061k (± 0.07%)338,410k (± 0.03%)+349k (+ 0.10%)338,263k338,727k
Parse Time2.10s (± 0.59%)2.11s (± 1.08%)+0.00s (+ 0.19%)2.06s2.15s
Bind Time0.86s (± 0.79%)0.85s (± 0.96%)-0.01s (- 1.39%)0.84s0.87s
Check Time5.87s (± 0.66%)5.86s (± 0.38%)-0.00s (- 0.03%)5.80s5.91s
Emit Time6.42s (± 0.89%)6.21s (± 0.65%)🟩-0.21s (- 3.32%)6.10s6.31s
Total Time15.25s (± 0.40%)15.03s (± 0.46%)-0.22s (- 1.48%)14.86s15.20s
Compiler-Unions - node (v12.1.0, x64)
Memory used193,184k (± 0.08%)193,416k (± 0.05%)+232k (+ 0.12%)193,200k193,619k
Parse Time0.83s (± 0.70%)0.83s (± 0.94%)+0.00s (+ 0.24%)0.82s0.85s
Bind Time0.55s (± 0.40%)0.55s (± 1.01%)+0.00s (+ 0.18%)0.54s0.57s
Check Time6.64s (± 0.65%)6.69s (± 0.53%)+0.05s (+ 0.72%)6.60s6.74s
Emit Time2.52s (± 0.77%)2.45s (± 0.73%)-0.07s (- 2.70%)2.41s2.49s
Total Time10.54s (± 0.44%)10.52s (± 0.37%)-0.02s (- 0.19%)10.42s10.58s
Monaco - node (v12.1.0, x64)
Memory used326,962k (± 0.02%)327,091k (± 0.02%)+129k (+ 0.04%)326,858k327,204k
Parse Time1.57s (± 0.77%)1.59s (± 0.76%)+0.01s (+ 0.70%)1.55s1.61s
Bind Time0.74s (± 0.66%)0.75s (± 0.60%)+0.00s (+ 0.54%)0.74s0.76s
Check Time5.81s (± 0.50%)5.84s (± 0.29%)+0.03s (+ 0.50%)5.80s5.89s
Emit Time3.30s (± 0.81%)3.31s (± 0.40%)+0.00s (+ 0.12%)3.28s3.34s
Total Time11.43s (± 0.44%)11.48s (± 0.32%)+0.05s (+ 0.47%)11.41s11.59s
TFS - node (v12.1.0, x64)
Memory used289,855k (± 0.02%)289,755k (± 0.07%)-99k (- 0.03%)289,180k289,969k
Parse Time1.30s (± 1.13%)1.31s (± 0.46%)+0.00s (+ 0.31%)1.29s1.32s
Bind Time0.72s (± 0.77%)0.72s (± 0.72%)-0.00s (- 0.42%)0.71s0.73s
Check Time5.37s (± 0.51%)5.37s (± 0.51%)+0.00s (+ 0.00%)5.33s5.43s
Emit Time3.51s (± 0.72%)3.53s (± 1.54%)+0.02s (+ 0.71%)3.45s3.72s
Total Time10.90s (± 0.44%)10.93s (± 0.66%)+0.03s (+ 0.27%)10.82s11.16s
material-ui - node (v12.1.0, x64)
Memory used448,741k (± 0.02%)448,586k (± 0.07%)-156k (- 0.03%)447,431k448,870k
Parse Time1.82s (± 0.54%)1.84s (± 0.58%)+0.02s (+ 1.04%)1.82s1.87s
Bind Time0.68s (± 0.74%)0.67s (± 0.74%)-0.00s (- 0.00%)0.66s0.68s
Check Time13.13s (± 0.57%)13.11s (± 0.85%)-0.02s (- 0.13%)12.85s13.28s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.62s (± 0.54%)15.63s (± 0.76%)+0.00s (+ 0.03%)15.34s15.83s
xstate - node (v12.1.0, x64)
Memory used544,241k (± 0.01%)544,352k (± 0.02%)+110k (+ 0.02%)544,177k544,603k
Parse Time2.53s (± 0.59%)2.55s (± 0.32%)+0.01s (+ 0.51%)2.53s2.57s
Bind Time1.04s (± 0.66%)1.04s (± 1.03%)+0.01s (+ 0.58%)1.02s1.07s
Check Time1.51s (± 0.39%)1.52s (± 0.49%)+0.01s (+ 0.73%)1.50s1.53s
Emit Time0.07s (± 0.00%)0.07s (± 0.00%)0.00s ( 0.00%)0.07s0.07s
Total Time5.15s (± 0.41%)5.17s (± 0.28%)+0.03s (+ 0.50%)5.15s5.22s
Angular - node (v14.15.1, x64)
Memory used336,429k (± 0.01%)336,523k (± 0.01%)+94k (+ 0.03%)336,432k336,565k
Parse Time2.07s (± 0.59%)2.07s (± 0.60%)-0.00s (- 0.19%)2.04s2.09s
Bind Time0.90s (± 0.62%)0.90s (± 0.58%)+0.00s (+ 0.33%)0.89s0.91s
Check Time5.83s (± 0.36%)5.85s (± 0.61%)+0.02s (+ 0.29%)5.78s5.94s
Emit Time6.39s (± 0.83%)6.19s (± 0.66%)🟩-0.20s (- 3.10%)6.12s6.29s
Total Time15.19s (± 0.44%)15.01s (± 0.33%)-0.18s (- 1.16%)14.95s15.18s
Compiler-Unions - node (v14.15.1, x64)
Memory used191,831k (± 0.02%)192,024k (± 0.02%)+193k (+ 0.10%)191,916k192,088k
Parse Time0.86s (± 0.82%)0.86s (± 0.78%)-0.00s (- 0.23%)0.84s0.87s
Bind Time0.58s (± 0.63%)0.58s (± 0.69%)+0.00s (+ 0.52%)0.57s0.59s
Check Time6.71s (± 0.70%)6.71s (± 0.90%)+0.01s (+ 0.09%)6.56s6.83s
Emit Time2.50s (± 1.33%)2.42s (± 0.70%)🟩-0.08s (- 3.24%)2.39s2.47s
Total Time10.64s (± 0.64%)10.56s (± 0.63%)-0.07s (- 0.68%)10.37s10.67s
Monaco - node (v14.15.1, x64)
Memory used325,760k (± 0.01%)325,915k (± 0.01%)+155k (+ 0.05%)325,874k325,958k
Parse Time1.59s (± 0.74%)1.58s (± 0.35%)-0.01s (- 0.44%)1.57s1.59s
Bind Time0.78s (± 0.67%)0.78s (± 0.29%)+0.00s (+ 0.26%)0.78s0.79s
Check Time5.71s (± 0.46%)5.73s (± 0.34%)+0.02s (+ 0.30%)5.67s5.77s
Emit Time3.36s (± 0.88%)3.36s (± 0.84%)-0.01s (- 0.21%)3.32s3.43s
Total Time11.44s (± 0.34%)11.45s (± 0.32%)+0.01s (+ 0.07%)11.38s11.53s
TFS - node (v14.15.1, x64)
Memory used288,895k (± 0.01%)288,963k (± 0.00%)+68k (+ 0.02%)288,935k289,002k
Parse Time1.34s (± 1.24%)1.35s (± 2.15%)+0.01s (+ 0.75%)1.29s1.42s
Bind Time0.74s (± 3.66%)0.76s (± 3.99%)+0.02s (+ 2.02%)0.73s0.86s
Check Time5.37s (± 0.42%)5.43s (± 0.42%)+0.06s (+ 1.10%)5.39s5.48s
Emit Time3.54s (± 1.71%)3.59s (± 2.01%)+0.05s (+ 1.27%)3.42s3.69s
Total Time10.99s (± 0.67%)11.12s (± 0.75%)+0.13s (+ 1.17%)10.87s11.27s
material-ui - node (v14.15.1, x64)
Memory used446,756k (± 0.07%)446,928k (± 0.00%)+172k (+ 0.04%)446,895k446,980k
Parse Time1.88s (± 0.39%)1.89s (± 0.61%)+0.01s (+ 0.48%)1.86s1.90s
Bind Time0.72s (± 0.86%)0.72s (± 0.94%)+0.01s (+ 0.70%)0.71s0.74s
Check Time13.24s (± 0.80%)13.25s (± 0.73%)+0.01s (+ 0.08%)13.03s13.43s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.84s (± 0.69%)15.86s (± 0.64%)+0.02s (+ 0.14%)15.65s16.05s
xstate - node (v14.15.1, x64)
Memory used541,995k (± 0.01%)542,160k (± 0.00%)+165k (+ 0.03%)542,124k542,210k
Parse Time2.60s (± 0.49%)2.60s (± 0.36%)+0.00s (+ 0.08%)2.58s2.62s
Bind Time1.16s (± 0.97%)1.16s (± 1.17%)+0.00s (+ 0.26%)1.14s1.20s
Check Time1.56s (± 0.61%)1.57s (± 0.67%)+0.01s (+ 0.64%)1.54s1.59s
Emit Time0.07s (± 3.14%)0.07s (± 4.13%)+0.00s (+ 1.41%)0.07s0.08s
Total Time5.38s (± 0.36%)5.40s (± 0.29%)+0.02s (+ 0.35%)5.37s5.44s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 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)
  • xstate - node (v10.16.3, x64)
  • xstate - node (v12.1.0, x64)
  • xstate - node (v14.15.1, x64)
BenchmarkNameIterations
Current5026610
Baselinemain10

TSServer

Comparison Report - main..50266
Metricmain50266DeltaBestWorst
Compiler-UnionsTSServer - node (v10.16.3, x64)
Req 1 - updateOpen1,453ms (± 0.41%)1,465ms (± 0.47%)+12ms (+ 0.81%)1,452ms1,479ms
Req 2 - geterr3,624ms (± 0.58%)3,658ms (± 0.47%)+33ms (+ 0.91%)3,603ms3,700ms
Req 3 - references279ms (± 2.13%)278ms (± 1.07%)-1ms (- 0.36%)274ms289ms
Req 4 - navto232ms (± 0.91%)233ms (± 0.43%)+1ms (+ 0.52%)231ms235ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo63ms (± 3.97%)65ms (± 3.48%)+2ms (+ 2.86%)61ms69ms
CompilerTSServer - node (v10.16.3, x64)
Req 1 - updateOpen1,558ms (± 0.48%)1,556ms (± 0.43%)-2ms (- 0.11%)1,537ms1,568ms
Req 2 - geterr2,279ms (± 0.42%)2,277ms (± 0.69%)-2ms (- 0.09%)2,243ms2,312ms
Req 3 - references305ms (± 1.47%)298ms (± 0.77%)-8ms (- 2.52%)290ms301ms
Req 4 - navto242ms (± 1.03%)239ms (± 1.74%)-3ms (- 1.24%)227ms244ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo69ms (± 2.70%)69ms (± 2.48%)0ms ( 0.00%)65ms74ms
xstateTSServer - node (v10.16.3, x64)
Req 1 - updateOpen2,177ms (± 0.43%)2,181ms (± 0.34%)+4ms (+ 0.20%)2,168ms2,196ms
Req 2 - geterr775ms (± 0.59%)776ms (± 0.66%)+1ms (+ 0.15%)760ms785ms
Req 3 - references98ms (± 1.89%)96ms (± 0.90%)-2ms (- 2.24%)94ms98ms
Req 4 - navto256ms (± 0.92%)257ms (± 0.95%)+1ms (+ 0.43%)251ms262ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo272ms (± 1.91%)274ms (± 1.25%)+2ms (+ 0.73%)266ms280ms
Compiler-UnionsTSServer - node (v12.1.0, x64)
Req 1 - updateOpen1,484ms (± 0.66%)1,483ms (± 0.73%)-1ms (- 0.07%)1,455ms1,508ms
Req 2 - geterr3,397ms (± 0.78%)3,405ms (± 0.81%)+9ms (+ 0.25%)3,351ms3,465ms
Req 3 - references261ms (± 1.08%)263ms (± 0.63%)+2ms (+ 0.92%)260ms267ms
Req 4 - navto205ms (± 0.71%)204ms (± 0.94%)-1ms (- 0.24%)200ms208ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo73ms (±15.81%)87ms (± 5.66%)+14ms (+19.40%)81ms106ms
CompilerTSServer - node (v12.1.0, x64)
Req 1 - updateOpen1,574ms (± 0.59%)1,571ms (± 0.41%)-2ms (- 0.14%)1,560ms1,586ms
Req 2 - geterr2,209ms (± 0.50%)2,225ms (± 0.84%)+16ms (+ 0.73%)2,191ms2,268ms
Req 3 - references273ms (± 0.71%)273ms (± 1.23%)-0ms (- 0.15%)267ms283ms
Req 4 - navto214ms (± 0.91%)216ms (± 1.08%)+2ms (+ 1.08%)213ms223ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo63ms (± 3.63%)63ms (± 3.27%)+0ms (+ 0.16%)58ms67ms
xstateTSServer - node (v12.1.0, x64)
Req 1 - updateOpen2,094ms (± 0.19%)2,116ms (± 0.66%)+21ms (+ 1.02%)2,081ms2,153ms
Req 2 - geterr763ms (± 0.57%)764ms (± 0.30%)+1ms (+ 0.07%)760ms770ms
Req 3 - references66ms (± 1.46%)67ms (± 1.67%)+1ms (+ 0.76%)63ms69ms
Req 4 - navto241ms (± 1.46%)244ms (± 0.83%)+4ms (+ 1.45%)239ms248ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo265ms (± 0.65%)263ms (± 0.69%)-3ms (- 0.98%)258ms267ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,527ms (± 0.25%)1,532ms (± 0.50%)+5ms (+ 0.34%)1,517ms1,549ms
Req 2 - geterr3,540ms (± 0.69%)3,538ms (± 0.51%)-2ms (- 0.07%)3,502ms3,583ms
Req 3 - references277ms (± 1.37%)277ms (± 0.34%)-1ms (- 0.29%)275ms279ms
Req 4 - navto218ms (± 0.73%)217ms (± 0.59%)-1ms (- 0.32%)215ms220ms
Req 5 - completionInfo count1,355 (± 0.00%)1,355 (± 0.00%)0 ( 0.00%)1,3551,355
Req 5 - completionInfo55ms (± 0.73%)58ms (± 6.06%)+3ms (+ 6.01%)54ms66ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen1,610ms (± 0.61%)1,615ms (± 0.83%)+5ms (+ 0.32%)1,588ms1,652ms
Req 2 - geterr2,347ms (± 0.61%)2,339ms (± 0.40%)-8ms (- 0.34%)2,325ms2,371ms
Req 3 - references288ms (± 1.14%)289ms (± 0.89%)+0ms (+ 0.07%)283ms295ms
Req 4 - navto229ms (± 0.81%)232ms (± 1.96%)+3ms (+ 1.49%)228ms250ms
Req 5 - completionInfo count1,517 (± 0.00%)1,517 (± 0.00%)0 ( 0.00%)1,5171,517
Req 5 - completionInfo53ms (± 0.84%)53ms (± 0.75%)+0ms (+ 0.57%)52ms54ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen2,230ms (± 0.44%)2,230ms (± 0.49%)-0ms (- 0.02%)2,204ms2,247ms
Req 2 - geterr780ms (± 0.36%)783ms (± 0.58%)+3ms (+ 0.41%)773ms793ms
Req 3 - references64ms (± 0.90%)65ms (± 0.90%)+1ms (+ 1.09%)64ms66ms
Req 4 - navto249ms (± 0.91%)250ms (± 0.95%)+1ms (+ 0.28%)246ms256ms
Req 5 - completionInfo count3,244 (± 0.00%)3,244 (± 0.00%)0 ( 0.00%)3,2443,244
Req 5 - completionInfo268ms (± 0.53%)268ms (± 0.67%)+1ms (+ 0.22%)264ms272ms
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 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
  • Compiler-UnionsTSServer - node (v10.16.3, x64)
  • Compiler-UnionsTSServer - node (v12.1.0, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v10.16.3, x64)
  • CompilerTSServer - node (v12.1.0, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v10.16.3, x64)
  • xstateTSServer - node (v12.1.0, x64)
  • xstateTSServer - node (v14.15.1, x64)
BenchmarkNameIterations
Current5026610
Baselinemain10

Developer Information:

Download Benchmark

@rbucktonrbuckton force-pushed the visitEachChildTable branch from 35b5e31 to dadca7f Compare August 11, 2022 22:29
@rbuckton

Have we decided on whether we prefer the Array or Object Literal variant for jump tables?

@jakebailey

Does the same type safety work for the array? My guess was not (especially if we are using push to keep the array compact)

@rbuckton

Does the same type safety work for the array? My guess was not (especially if we are using push to keep the array compact)

No, it doesn't. To do the same thing with an array would require using an array literal and packing it with leading undefined values for all the token nodes.

@jakebailey

For me, if the perf is the same, I'd prefer the safer one.

@DanielRosenwasser

Yeah, ultimately I didn't see enough of a win doing one over the other.

Sign up for free to join this conversation on . Already have an account? Sign in to comment
Author: Team For Uncommitted BugPR for untriaged, rejected, closed or missing bug
None yet

Successfully merging this pull request may close these issues.