GeezerVison is showing github.com — Leave switch as-is but just extract branches to function calls by weswigham · Pull Request #50245 · microsoft/TypeScript
Conversation
Just to see if this alone has a perf diff.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
DanielRosenwasser reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Wesley Wigham (@weswigham)
The results of the perf run you requested are in!
Here they are:
Comparison Report - main..50245
| Metric |
main |
50245 |
Delta |
Best |
Worst |
| Angular - node (v14.15.1, x64) |
| Memory used |
336,247k (± 0.01%) |
336,443k (± 0.01%) |
+197k (+ 0.06%) |
336,383k |
336,504k |
| Parse Time |
2.06s (± 0.31%) |
2.05s (± 0.43%) |
-0.00s (- 0.19%) |
2.04s |
2.08s |
| Bind Time |
0.89s (± 0.41%) |
0.84s (± 0.59%) |
🟩-0.05s (- 5.59%) |
0.84s |
0.86s |
| Check Time |
5.82s (± 0.32%) |
5.81s (± 0.54%) |
-0.01s (- 0.15%) |
5.75s |
5.91s |
| Emit Time |
6.36s (± 0.41%) |
6.40s (± 0.64%) |
+0.04s (+ 0.60%) |
6.32s |
6.50s |
| Total Time |
15.13s (± 0.25%) |
15.11s (± 0.37%) |
-0.02s (- 0.15%) |
15.01s |
15.28s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
191,680k (± 0.12%) |
191,857k (± 0.11%) |
+178k (+ 0.09%) |
190,997k |
192,027k |
| Parse Time |
0.85s (± 0.61%) |
0.85s (± 0.61%) |
+0.00s (+ 0.24%) |
0.84s |
0.86s |
| Bind Time |
0.57s (± 1.36%) |
0.52s (± 1.00%) |
🟩-0.05s (- 8.76%) |
0.51s |
0.53s |
| Check Time |
6.67s (± 0.65%) |
6.63s (± 0.80%) |
-0.04s (- 0.55%) |
6.53s |
6.79s |
| Emit Time |
2.49s (± 1.06%) |
2.49s (± 0.62%) |
-0.00s (- 0.04%) |
2.46s |
2.53s |
| Total Time |
10.58s (± 0.56%) |
10.50s (± 0.56%) |
-0.08s (- 0.80%) |
10.38s |
10.68s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,744k (± 0.00%) |
325,908k (± 0.01%) |
+164k (+ 0.05%) |
325,834k |
325,952k |
| Parse Time |
1.58s (± 0.67%) |
1.57s (± 0.71%) |
-0.01s (- 0.57%) |
1.55s |
1.60s |
| Bind Time |
0.78s (± 1.19%) |
0.75s (± 0.40%) |
🟩-0.03s (- 3.34%) |
0.75s |
0.76s |
| Check Time |
5.69s (± 0.43%) |
5.69s (± 0.44%) |
-0.00s (- 0.04%) |
5.65s |
5.76s |
| Emit Time |
3.36s (± 0.75%) |
3.35s (± 0.61%) |
-0.00s (- 0.00%) |
3.31s |
3.42s |
| Total Time |
11.40s (± 0.45%) |
11.37s (± 0.33%) |
-0.04s (- 0.33%) |
11.29s |
11.47s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,908k (± 0.01%) |
289,069k (± 0.01%) |
+161k (+ 0.06%) |
289,022k |
289,107k |
| Parse Time |
1.35s (± 1.45%) |
1.35s (± 1.56%) |
+0.00s (+ 0.37%) |
1.30s |
1.41s |
| Bind Time |
0.74s (± 1.35%) |
0.71s (± 0.84%) |
🟩-0.04s (- 5.11%) |
0.69s |
0.72s |
| Check Time |
5.35s (± 0.44%) |
5.34s (± 0.64%) |
-0.01s (- 0.15%) |
5.29s |
5.43s |
| Emit Time |
3.57s (± 1.88%) |
3.66s (± 0.39%) |
+0.08s (+ 2.29%) |
3.63s |
3.68s |
| Total Time |
11.01s (± 0.66%) |
11.05s (± 0.27%) |
+0.04s (+ 0.35%) |
10.99s |
11.13s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
446,736k (± 0.07%) |
447,100k (± 0.01%) |
+364k (+ 0.08%) |
447,033k |
447,191k |
| Parse Time |
1.87s (± 0.43%) |
1.87s (± 0.69%) |
-0.00s (- 0.11%) |
1.85s |
1.90s |
| Bind Time |
0.72s (± 0.80%) |
0.64s (± 0.87%) |
🟩-0.08s (-11.20%) |
0.63s |
0.66s |
| Check Time |
13.20s (± 0.72%) |
13.18s (± 0.73%) |
-0.02s (- 0.17%) |
12.98s |
13.40s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.80s (± 0.64%) |
15.69s (± 0.61%) |
-0.11s (- 0.68%) |
15.50s |
15.92s |
| xstate - node (v14.15.1, x64) |
| Memory used |
541,914k (± 0.00%) |
542,530k (± 0.00%) |
+616k (+ 0.11%) |
542,472k |
542,579k |
| Parse Time |
2.60s (± 0.43%) |
2.60s (± 0.46%) |
-0.00s (- 0.08%) |
2.58s |
2.63s |
| Bind Time |
1.15s (± 0.98%) |
1.05s (± 0.97%) |
🟩-0.10s (- 8.86%) |
1.04s |
1.08s |
| Check Time |
1.55s (± 0.47%) |
1.55s (± 0.65%) |
+0.00s (+ 0.13%) |
1.54s |
1.58s |
| Emit Time |
0.07s (± 4.95%) |
0.07s (± 0.00%) |
🟩-0.01s (- 6.67%) |
0.07s |
0.07s |
| Total Time |
5.38s (± 0.34%) |
5.28s (± 0.37%) |
-0.10s (- 1.82%) |
5.24s |
5.34s |
System
| Machine Name | ts-ci-ubuntu |
| Platform | linux 4.4.0-210-generic |
| Architecture | x64 |
| Available Memory | 16 GB |
| Available Memory | 15 GB |
| CPUs | 4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz |
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)
- xstate - node (v14.15.1, x64)
| Benchmark |
Name |
Iterations |
| Current |
50245 |
10 |
| Baseline |
main |
10 |
Developer Information:Download Benchmark
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Daniel Rosenwasser (@DanielRosenwasser) good news! The perf improvements aren't from the switch-case change, and I'm not going crazy reading the v8 source code, unable to figure out why the switch was deoptimized (when, in fact, it wasn't)! Just extracting the various cases into individual functions looks to be most if not all of the performance improvement. So it looks like it's not the switch that's an issue, but rather the length and polymorphism of the function itself.
|
DanielRosenwasser reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Wesley Wigham (@weswigham)
The results of the perf run you requested are in!
Here they are:
Compiler
Comparison Report - main..50245
| Metric |
main |
50245 |
Delta |
Best |
Worst |
| Angular - node (v10.16.3, x64) |
| Memory used |
360,482k (± 0.02%) |
360,727k (± 0.02%) |
+245k (+ 0.07%) |
360,600k |
360,845k |
| Parse Time |
2.10s (± 0.39%) |
2.11s (± 0.59%) |
+0.01s (+ 0.48%) |
2.09s |
2.15s |
| Bind Time |
0.90s (± 1.06%) |
0.84s (± 0.69%) |
🟩-0.05s (- 5.92%) |
0.83s |
0.86s |
| Check Time |
6.03s (± 0.44%) |
6.01s (± 0.51%) |
-0.02s (- 0.38%) |
5.93s |
6.06s |
| Emit Time |
6.17s (± 0.95%) |
6.18s (± 0.72%) |
+0.01s (+ 0.23%) |
6.08s |
6.26s |
| Total Time |
15.21s (± 0.54%) |
15.15s (± 0.45%) |
-0.06s (- 0.39%) |
14.97s |
15.27s |
| Compiler-Unions - node (v10.16.3, x64) |
| Memory used |
205,599k (± 0.04%) |
205,751k (± 0.03%) |
+152k (+ 0.07%) |
205,612k |
205,932k |
| Parse Time |
0.83s (± 0.93%) |
0.83s (± 0.40%) |
-0.00s (- 0.12%) |
0.82s |
0.84s |
| Bind Time |
0.52s (± 1.56%) |
0.50s (± 0.96%) |
🟩-0.03s (- 4.97%) |
0.49s |
0.51s |
| Check Time |
7.09s (± 0.54%) |
7.03s (± 0.44%) |
-0.06s (- 0.83%) |
6.94s |
7.10s |
| Emit Time |
2.51s (± 0.91%) |
2.54s (± 0.75%) |
+0.03s (+ 1.24%) |
2.51s |
2.58s |
| Total Time |
10.95s (± 0.55%) |
10.89s (± 0.39%) |
-0.06s (- 0.51%) |
10.78s |
10.98s |
| Monaco - node (v10.16.3, x64) |
| Memory used |
344,006k (± 0.02%) |
344,152k (± 0.01%) |
+146k (+ 0.04%) |
344,097k |
344,273k |
| Parse Time |
1.60s (± 0.36%) |
1.60s (± 0.73%) |
-0.00s (- 0.06%) |
1.56s |
1.62s |
| Bind Time |
0.75s (± 0.48%) |
0.73s (± 0.96%) |
🟩-0.03s (- 3.32%) |
0.72s |
0.75s |
| Check Time |
5.98s (± 0.53%) |
5.98s (± 0.95%) |
-0.00s (- 0.02%) |
5.80s |
6.06s |
| Emit Time |
3.25s (± 0.70%) |
3.29s (± 1.06%) |
+0.04s (+ 1.26%) |
3.20s |
3.36s |
| Total Time |
11.59s (± 0.40%) |
11.60s (± 0.47%) |
+0.02s (+ 0.13%) |
11.47s |
11.73s |
| TFS - node (v10.16.3, x64) |
| Memory used |
305,299k (± 0.03%) |
305,443k (± 0.03%) |
+144k (+ 0.05%) |
305,209k |
305,652k |
| Parse Time |
1.29s (± 0.63%) |
1.28s (± 0.46%) |
-0.00s (- 0.23%) |
1.27s |
1.30s |
| Bind Time |
0.72s (± 0.66%) |
0.70s (± 0.97%) |
-0.01s (- 1.81%) |
0.69s |
0.72s |
| Check Time |
5.41s (± 0.35%) |
5.45s (± 0.50%) |
+0.04s (+ 0.68%) |
5.40s |
5.50s |
| Emit Time |
3.43s (± 1.28%) |
3.53s (± 1.68%) |
+0.10s (+ 3.00%) |
3.41s |
3.67s |
| Total Time |
10.85s (± 0.50%) |
10.97s (± 0.72%) |
+0.12s (+ 1.10%) |
10.83s |
11.15s |
| material-ui - node (v10.16.3, x64) |
| Memory used |
469,616k (± 0.01%) |
469,779k (± 0.02%) |
+163k (+ 0.03%) |
469,582k |
469,956k |
| Parse Time |
1.83s (± 0.44%) |
1.83s (± 0.82%) |
+0.00s (+ 0.05%) |
1.81s |
1.86s |
| Bind Time |
0.69s (± 1.60%) |
0.63s (± 1.58%) |
🟩-0.06s (- 8.26%) |
0.61s |
0.65s |
| Check Time |
14.55s (± 0.66%) |
14.60s (± 0.97%) |
+0.05s (+ 0.37%) |
14.39s |
15.00s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
17.07s (± 0.56%) |
17.07s (± 0.87%) |
-0.00s (- 0.02%) |
16.84s |
17.48s |
| xstate - node (v10.16.3, x64) |
| Memory used |
578,760k (± 0.02%) |
579,382k (± 0.01%) |
+622k (+ 0.11%) |
579,255k |
579,527k |
| Parse Time |
2.60s (± 0.41%) |
2.60s (± 0.23%) |
+0.01s (+ 0.31%) |
2.59s |
2.61s |
| Bind Time |
1.02s (± 0.99%) |
0.94s (± 0.63%) |
🟩-0.08s (- 7.87%) |
0.93s |
0.95s |
| Check Time |
1.57s (± 0.56%) |
1.57s (± 0.67%) |
+0.01s (+ 0.38%) |
1.54s |
1.59s |
| Emit Time |
0.07s (± 3.14%) |
0.07s (± 0.00%) |
-0.00s (- 1.41%) |
0.07s |
0.07s |
| Total Time |
5.25s (± 0.34%) |
5.18s (± 0.24%) |
-0.07s (- 1.26%) |
5.14s |
5.20s |
| Angular - node (v12.1.0, x64) |
| Memory used |
337,877k (± 0.08%) |
338,315k (± 0.02%) |
+438k (+ 0.13%) |
338,174k |
338,428k |
| Parse Time |
2.08s (± 0.45%) |
2.08s (± 0.44%) |
+0.00s (+ 0.14%) |
2.06s |
2.10s |
| Bind Time |
0.85s (± 0.58%) |
0.82s (± 0.61%) |
🟩-0.04s (- 4.68%) |
0.81s |
0.83s |
| Check Time |
5.85s (± 0.81%) |
5.82s (± 0.48%) |
-0.03s (- 0.53%) |
5.78s |
5.91s |
| Emit Time |
6.44s (± 0.96%) |
6.40s (± 0.64%) |
-0.05s (- 0.73%) |
6.31s |
6.53s |
| Total Time |
15.23s (± 0.57%) |
15.12s (± 0.35%) |
-0.12s (- 0.76%) |
15.02s |
15.23s |
| Compiler-Unions - node (v12.1.0, x64) |
| Memory used |
193,244k (± 0.02%) |
192,941k (± 0.31%) |
-303k (- 0.16%) |
190,685k |
193,507k |
| Parse Time |
0.83s (± 0.72%) |
0.82s (± 0.58%) |
-0.00s (- 0.36%) |
0.81s |
0.83s |
| Bind Time |
0.55s (± 0.94%) |
0.51s (± 0.99%) |
🟩-0.05s (- 8.35%) |
0.50s |
0.52s |
| Check Time |
6.64s (± 0.60%) |
6.63s (± 0.46%) |
-0.00s (- 0.08%) |
6.58s |
6.71s |
| Emit Time |
2.54s (± 1.44%) |
2.54s (± 0.99%) |
-0.00s (- 0.08%) |
2.49s |
2.59s |
| Total Time |
10.56s (± 0.33%) |
10.50s (± 0.35%) |
-0.06s (- 0.53%) |
10.43s |
10.60s |
| Monaco - node (v12.1.0, x64) |
| Memory used |
326,952k (± 0.02%) |
327,088k (± 0.01%) |
+136k (+ 0.04%) |
326,996k |
327,203k |
| Parse Time |
1.57s (± 0.74%) |
1.58s (± 0.74%) |
+0.00s (+ 0.32%) |
1.54s |
1.60s |
| Bind Time |
0.74s (± 0.70%) |
0.72s (± 0.82%) |
-0.02s (- 2.03%) |
0.71s |
0.74s |
| Check Time |
5.81s (± 0.46%) |
5.83s (± 0.57%) |
+0.02s (+ 0.28%) |
5.77s |
5.92s |
| Emit Time |
3.30s (± 0.93%) |
3.30s (± 0.72%) |
-0.01s (- 0.21%) |
3.26s |
3.37s |
| Total Time |
11.43s (± 0.41%) |
11.43s (± 0.36%) |
-0.00s (- 0.03%) |
11.35s |
11.54s |
| TFS - node (v12.1.0, x64) |
| Memory used |
289,789k (± 0.06%) |
290,035k (± 0.03%) |
+246k (+ 0.08%) |
289,923k |
290,248k |
| Parse Time |
1.29s (± 1.18%) |
1.30s (± 0.83%) |
+0.00s (+ 0.39%) |
1.28s |
1.33s |
| Bind Time |
0.72s (± 0.93%) |
0.68s (± 1.21%) |
🟩-0.03s (- 4.60%) |
0.67s |
0.71s |
| Check Time |
5.38s (± 0.50%) |
5.36s (± 0.33%) |
-0.02s (- 0.33%) |
5.32s |
5.40s |
| Emit Time |
3.53s (± 0.62%) |
3.51s (± 1.06%) |
-0.02s (- 0.42%) |
3.44s |
3.61s |
| Total Time |
10.92s (± 0.37%) |
10.86s (± 0.39%) |
-0.06s (- 0.55%) |
10.73s |
10.97s |
| material-ui - node (v12.1.0, x64) |
| Memory used |
448,726k (± 0.01%) |
448,824k (± 0.06%) |
+99k (+ 0.02%) |
447,695k |
449,108k |
| Parse Time |
1.82s (± 0.55%) |
1.82s (± 0.66%) |
+0.00s (+ 0.05%) |
1.81s |
1.87s |
| Bind Time |
0.67s (± 0.70%) |
0.60s (± 0.82%) |
🟩-0.07s (- 9.85%) |
0.60s |
0.62s |
| Check Time |
13.04s (± 0.73%) |
13.10s (± 0.64%) |
+0.06s (+ 0.45%) |
12.94s |
13.32s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.54s (± 0.65%) |
15.53s (± 0.57%) |
-0.00s (- 0.03%) |
15.37s |
15.75s |
| xstate - node (v12.1.0, x64) |
| Memory used |
547,481k (± 1.32%) |
544,834k (± 0.02%) |
-2,647k (- 0.48%) |
544,622k |
545,234k |
| Parse Time |
2.54s (± 0.39%) |
2.55s (± 0.54%) |
+0.01s (+ 0.28%) |
2.52s |
2.58s |
| Bind Time |
1.03s (± 1.37%) |
0.93s (± 1.58%) |
🟩-0.11s (-10.45%) |
0.91s |
0.98s |
| Check Time |
1.51s (± 0.60%) |
1.52s (± 0.39%) |
+0.01s (+ 0.33%) |
1.50s |
1.53s |
| Emit Time |
0.07s (± 0.00%) |
0.07s (± 0.00%) |
0.00s ( 0.00%) |
0.07s |
0.07s |
| Total Time |
5.16s (± 0.43%) |
5.06s (± 0.45%) |
-0.10s (- 1.86%) |
5.01s |
5.12s |
| Angular - node (v14.15.1, x64) |
| Memory used |
336,295k (± 0.01%) |
336,439k (± 0.01%) |
+145k (+ 0.04%) |
336,390k |
336,488k |
| Parse Time |
2.07s (± 0.70%) |
2.06s (± 0.61%) |
-0.00s (- 0.24%) |
2.04s |
2.09s |
| Bind Time |
0.89s (± 0.50%) |
0.85s (± 0.56%) |
🟩-0.04s (- 4.62%) |
0.84s |
0.86s |
| Check Time |
5.85s (± 0.25%) |
5.83s (± 0.64%) |
-0.02s (- 0.31%) |
5.75s |
5.93s |
| Emit Time |
6.36s (± 0.58%) |
6.41s (± 1.06%) |
+0.05s (+ 0.74%) |
6.27s |
6.54s |
| Total Time |
15.16s (± 0.35%) |
15.14s (± 0.65%) |
-0.01s (- 0.09%) |
14.91s |
15.38s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
191,835k (± 0.01%) |
191,985k (± 0.02%) |
+150k (+ 0.08%) |
191,924k |
192,083k |
| Parse Time |
0.85s (± 0.65%) |
0.85s (± 0.52%) |
0.00s ( 0.00%) |
0.84s |
0.86s |
| Bind Time |
0.57s (± 0.63%) |
0.52s (± 0.43%) |
🟩-0.06s (- 9.58%) |
0.51s |
0.52s |
| Check Time |
6.67s (± 0.61%) |
6.65s (± 0.81%) |
-0.02s (- 0.36%) |
6.51s |
6.74s |
| Emit Time |
2.50s (± 1.44%) |
2.49s (± 0.65%) |
-0.01s (- 0.48%) |
2.46s |
2.53s |
| Total Time |
10.60s (± 0.40%) |
10.51s (± 0.56%) |
-0.09s (- 0.89%) |
10.38s |
10.61s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,761k (± 0.01%) |
325,901k (± 0.01%) |
+139k (+ 0.04%) |
325,843k |
325,929k |
| Parse Time |
1.58s (± 0.42%) |
1.58s (± 0.89%) |
+0.00s (+ 0.19%) |
1.56s |
1.61s |
| Bind Time |
0.78s (± 0.67%) |
0.75s (± 0.49%) |
🟩-0.02s (- 3.08%) |
0.75s |
0.76s |
| Check Time |
5.71s (± 0.39%) |
5.67s (± 0.35%) |
-0.04s (- 0.65%) |
5.63s |
5.71s |
| Emit Time |
3.38s (± 0.80%) |
3.34s (± 0.48%) |
-0.04s (- 1.24%) |
3.30s |
3.37s |
| Total Time |
11.44s (± 0.24%) |
11.35s (± 0.31%) |
-0.10s (- 0.85%) |
11.26s |
11.42s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,887k (± 0.01%) |
289,088k (± 0.01%) |
+202k (+ 0.07%) |
289,047k |
289,132k |
| Parse Time |
1.34s (± 2.18%) |
1.33s (± 0.98%) |
-0.01s (- 1.04%) |
1.29s |
1.35s |
| Bind Time |
0.74s (± 3.55%) |
0.73s (± 4.38%) |
-0.02s (- 2.42%) |
0.69s |
0.82s |
| Check Time |
5.37s (± 0.39%) |
5.32s (± 0.35%) |
-0.05s (- 0.84%) |
5.29s |
5.37s |
| Emit Time |
3.58s (± 2.21%) |
3.62s (± 1.56%) |
+0.04s (+ 1.12%) |
3.46s |
3.68s |
| Total Time |
11.04s (± 0.92%) |
11.00s (± 0.53%) |
-0.04s (- 0.34%) |
10.83s |
11.11s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
446,924k (± 0.01%) |
447,092k (± 0.01%) |
+168k (+ 0.04%) |
446,998k |
447,170k |
| Parse Time |
1.87s (± 0.46%) |
1.87s (± 0.57%) |
+0.00s (+ 0.05%) |
1.85s |
1.89s |
| Bind Time |
0.72s (± 0.68%) |
0.64s (± 0.53%) |
🟩-0.08s (-11.19%) |
0.64s |
0.65s |
| Check Time |
13.15s (± 0.49%) |
13.20s (± 0.54%) |
+0.05s (+ 0.37%) |
13.01s |
13.33s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.74s (± 0.46%) |
15.71s (± 0.45%) |
-0.03s (- 0.21%) |
15.53s |
15.87s |
| xstate - node (v14.15.1, x64) |
| Memory used |
541,989k (± 0.00%) |
542,531k (± 0.00%) |
+542k (+ 0.10%) |
542,478k |
542,578k |
| Parse Time |
2.60s (± 0.32%) |
2.61s (± 0.48%) |
+0.01s (+ 0.42%) |
2.58s |
2.63s |
| Bind Time |
1.16s (± 0.70%) |
1.05s (± 0.55%) |
🟩-0.11s (- 9.74%) |
1.04s |
1.06s |
| Check Time |
1.55s (± 0.52%) |
1.56s (± 0.45%) |
+0.01s (+ 0.71%) |
1.55s |
1.58s |
| Emit Time |
0.07s (± 3.14%) |
0.07s (± 0.00%) |
-0.00s (- 1.41%) |
0.07s |
0.07s |
| Total Time |
5.38s (± 0.16%) |
5.28s (± 0.29%) |
-0.10s (- 1.80%) |
5.23s |
5.30s |
System
| Machine Name | ts-ci-ubuntu |
| Platform | linux 4.4.0-210-generic |
| Architecture | x64 |
| Available Memory | 16 GB |
| Available Memory | 15 GB |
| CPUs | 4 × 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)
| Benchmark |
Name |
Iterations |
| Current |
50245 |
10 |
| Baseline |
main |
10 |
TSServer
Comparison Report - main..50245
| Metric |
main |
50245 |
Delta |
Best |
Worst |
| Compiler-UnionsTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
1,453ms (± 0.37%) |
1,429ms (± 0.40%) |
-24ms (- 1.67%) |
1,417ms |
1,442ms |
| Req 2 - geterr |
3,617ms (± 0.32%) |
3,584ms (± 0.49%) |
-34ms (- 0.93%) |
3,541ms |
3,626ms |
| Req 3 - references |
276ms (± 0.69%) |
232ms (± 0.53%) |
🟩-45ms (-16.11%) |
229ms |
235ms |
| Req 4 - navto |
231ms (± 0.76%) |
174ms (± 1.37%) |
🟩-57ms (-24.85%) |
167ms |
179ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
64ms (± 3.30%) |
62ms (± 2.83%) |
🟩-2ms (- 3.59%) |
59ms |
67ms |
| CompilerTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
1,552ms (± 0.59%) |
1,524ms (± 0.66%) |
-28ms (- 1.79%) |
1,498ms |
1,548ms |
| Req 2 - geterr |
2,265ms (± 0.46%) |
2,227ms (± 0.45%) |
-38ms (- 1.68%) |
2,207ms |
2,242ms |
| Req 3 - references |
295ms (± 0.75%) |
244ms (± 0.87%) |
🟩-50ms (-17.11%) |
240ms |
249ms |
| Req 4 - navto |
237ms (± 2.09%) |
188ms (± 1.01%) |
🟩-49ms (-20.51%) |
183ms |
191ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
66ms (± 2.97%) |
69ms (± 0.75%) |
+4ms (+ 5.50%) |
68ms |
70ms |
| xstateTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
2,175ms (± 0.58%) |
2,104ms (± 0.53%) |
🟩-71ms (- 3.25%) |
2,083ms |
2,134ms |
| Req 2 - geterr |
776ms (± 0.42%) |
778ms (± 0.75%) |
+2ms (+ 0.23%) |
766ms |
793ms |
| Req 3 - references |
97ms (± 1.16%) |
98ms (± 3.89%) |
+1ms (+ 1.14%) |
95ms |
113ms |
| Req 4 - navto |
256ms (± 0.89%) |
242ms (± 1.10%) |
🟩-14ms (- 5.36%) |
236ms |
248ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
274ms (± 1.49%) |
271ms (± 1.11%) |
-3ms (- 1.10%) |
263ms |
275ms |
| Compiler-UnionsTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
1,485ms (± 0.52%) |
1,438ms (± 0.55%) |
🟩-47ms (- 3.13%) |
1,420ms |
1,456ms |
| Req 2 - geterr |
3,412ms (± 0.60%) |
3,351ms (± 0.47%) |
-61ms (- 1.78%) |
3,309ms |
3,371ms |
| Req 3 - references |
262ms (± 0.76%) |
220ms (± 0.68%) |
🟩-42ms (-15.94%) |
217ms |
223ms |
| Req 4 - navto |
206ms (± 0.69%) |
161ms (± 0.91%) |
🟩-45ms (-21.90%) |
157ms |
163ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
72ms (±15.95%) |
59ms (±10.30%) |
🟩-13ms (-17.78%) |
54ms |
83ms |
| CompilerTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
1,566ms (± 0.46%) |
1,529ms (± 0.46%) |
-38ms (- 2.41%) |
1,512ms |
1,545ms |
| Req 2 - geterr |
2,201ms (± 0.43%) |
2,163ms (± 0.48%) |
-38ms (- 1.72%) |
2,145ms |
2,195ms |
| Req 3 - references |
272ms (± 0.97%) |
236ms (± 0.87%) |
🟩-37ms (-13.51%) |
231ms |
240ms |
| Req 4 - navto |
217ms (± 1.96%) |
175ms (± 1.31%) |
🟩-42ms (-19.44%) |
171ms |
181ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
60ms (± 3.64%) |
62ms (± 4.89%) |
+2ms (+ 3.49%) |
55ms |
66ms |
| xstateTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
2,098ms (± 0.22%) |
2,061ms (± 0.63%) |
-37ms (- 1.77%) |
2,042ms |
2,100ms |
| Req 2 - geterr |
762ms (± 0.57%) |
767ms (± 0.72%) |
+4ms (+ 0.56%) |
759ms |
784ms |
| Req 3 - references |
65ms (± 1.75%) |
66ms (± 1.28%) |
+1ms (+ 1.38%) |
64ms |
68ms |
| Req 4 - navto |
243ms (± 0.84%) |
230ms (± 1.49%) |
🟩-12ms (- 5.03%) |
225ms |
241ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
264ms (± 1.21%) |
265ms (± 1.81%) |
+1ms (+ 0.49%) |
257ms |
280ms |
| Compiler-UnionsTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
1,529ms (± 0.41%) |
1,477ms (± 0.60%) |
🟩-52ms (- 3.39%) |
1,455ms |
1,498ms |
| Req 2 - geterr |
3,542ms (± 0.33%) |
3,523ms (± 0.47%) |
-19ms (- 0.52%) |
3,493ms |
3,570ms |
| Req 3 - references |
277ms (± 0.36%) |
231ms (± 0.70%) |
🟩-45ms (-16.41%) |
229ms |
237ms |
| Req 4 - navto |
217ms (± 0.48%) |
170ms (± 1.00%) |
🟩-47ms (-21.72%) |
167ms |
175ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
57ms (± 5.37%) |
58ms (± 5.54%) |
+0ms (+ 0.35%) |
55ms |
66ms |
| CompilerTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
1,603ms (± 0.56%) |
1,557ms (± 0.83%) |
-47ms (- 2.91%) |
1,535ms |
1,596ms |
| Req 2 - geterr |
2,334ms (± 0.34%) |
2,304ms (± 0.48%) |
-30ms (- 1.27%) |
2,279ms |
2,323ms |
| Req 3 - references |
284ms (± 0.48%) |
243ms (± 0.56%) |
🟩-41ms (-14.56%) |
240ms |
246ms |
| Req 4 - navto |
228ms (± 0.33%) |
180ms (± 0.41%) |
🟩-48ms (-20.92%) |
178ms |
182ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
53ms (± 0.98%) |
53ms (± 1.05%) |
-0ms (- 0.56%) |
52ms |
54ms |
| xstateTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
2,226ms (± 0.51%) |
2,176ms (± 0.40%) |
-49ms (- 2.21%) |
2,160ms |
2,193ms |
| Req 2 - geterr |
780ms (± 0.39%) |
782ms (± 0.39%) |
+2ms (+ 0.26%) |
775ms |
789ms |
| Req 3 - references |
64ms (± 0.73%) |
65ms (± 1.30%) |
+1ms (+ 1.72%) |
64ms |
68ms |
| Req 4 - navto |
249ms (± 0.82%) |
236ms (± 0.82%) |
🟩-14ms (- 5.42%) |
230ms |
239ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
267ms (± 0.40%) |
268ms (± 0.77%) |
+0ms (+ 0.04%) |
262ms |
271ms |
System
| Machine Name | ts-ci-ubuntu |
| Platform | linux 4.4.0-210-generic |
| Architecture | x64 |
| Available Memory | 16 GB |
| Available Memory | 15 GB |
| CPUs | 4 × 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)
| Benchmark |
Name |
Iterations |
| Current |
50245 |
10 |
| Baseline |
main |
10 |
Developer Information:Download Benchmark
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I do like the improved safety of this one over #50225.
Would the perf be identical if these functions were instead declared at the bottom of forEachChild? That way, nobody could actually try and call them.
(This is probably very moot post-modules, as this whole thing could be its own file that doesn't export them.)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I wonder if V8 is using a jump table for the switch now that it has no fall-through cases.
Would the perf be identical if these functions were instead declared at the bottom of forEachChild? That way, nobody could actually try and call them.
These functions don't need to be exported from ts either and it might make sense to just move forEachChild et all to its own file anyways.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I ultimately like Daniel Rosenwasser (@DanielRosenwasser) 's PR more, simply because it is yet more performant, but it looks like the perf improvement is correlated with the instruction length of the function and not the presence or lack thereof of the switch, which is what I wanted to confirm with this.
|
DanielRosenwasser reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I wonder if V8 is using a jump table for the switch now that it has no fall-through cases.
Based on the conditions for switch optimization I read in the v8 sources, both before this PR and with this PR, the switch should be optimized to a jump table. For an interpreted function, you get a jump table so long as you have a minimum number of branches and cover at least 33% of the range of inputs (measured as the difference between the min and max case values). On x64, for a compiled function, there's a somewhat complex space/time tradeoff heuristic where it falls back to a binary search, but it weights the time metric more, and for anything with a somewhat densely filled out list of cases, should prefer the jump table. There's links to the relevant v8 sources in our internal discussions, if you're curious about the exact heuristic. AFAIK, the 128 case limit mentioned in the recently-trended blog post about a perf problem from 2013 no longer seems to exist - on x64, the max case count for a jump table is 2 << 16. (And fall throughs don't seem to affect it in any way - they count as a case same as any other)
|
PocketlawErik reacted with rocket emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Copilot will automatically review once the pull request is marked ready for review
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|