GeezerVison is showing github.com — Swap `forEachChild` to use a table of functions instead of a `switch` statement. by DanielRosenwasser · Pull Request #50225 · microsoft/TypeScript
Conversation
forEachChild is one of the core pieces of machinery we have for traversing nodes in our trees. It's coded using a fairly large switch statement; however, while reading up on an emulator built in JavaScript (https://artemis.sh/2022/08/07/emulating-calculators-fast-in-js.html), the author called out that most engines do not seem to do the jump-table optimization that some compilers use for switch statements.
So this change introduces a function table for all of forEachChild.
In some other experimentation (namely #50245) it seems like the failure to optimize might have more to do with the function size than the switch/case itself. Regardless, this change seems to cut off around 50ms - 150ms from each perf test's compile time, and speeds up several operations in the language service.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
omril1, SlurpTheo, Conaclos, tonivj5, and Kobzol reacted with rocket 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.
|
Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!
Here they are:
Comparison Report - main..50225
| Metric |
main |
50225 |
Delta |
Best |
Worst |
| Angular - node (v14.15.1, x64) |
| Memory used |
336,174k (± 0.01%) |
336,394k (± 0.01%) |
+220k (+ 0.07%) |
336,277k |
336,485k |
| Parse Time |
2.08s (± 1.12%) |
2.06s (± 0.48%) |
-0.02s (- 1.15%) |
2.04s |
2.08s |
| Bind Time |
0.89s (± 0.65%) |
0.79s (± 0.63%) |
🟩-0.11s (-12.09%) |
0.77s |
0.79s |
| Check Time |
5.81s (± 0.48%) |
5.81s (± 0.51%) |
+0.00s (+ 0.03%) |
5.74s |
5.88s |
| Emit Time |
6.38s (± 0.66%) |
6.40s (± 0.51%) |
+0.02s (+ 0.30%) |
6.34s |
6.50s |
| Total Time |
15.17s (± 0.49%) |
15.07s (± 0.38%) |
-0.11s (- 0.71%) |
14.96s |
15.24s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
191,796k (± 0.01%) |
191,942k (± 0.01%) |
+146k (+ 0.08%) |
191,890k |
192,001k |
| Parse Time |
0.85s (± 0.61%) |
0.85s (± 0.61%) |
0.00s ( 0.00%) |
0.84s |
0.86s |
| Bind Time |
0.57s (± 1.66%) |
0.48s (± 0.75%) |
🟩-0.09s (-15.68%) |
0.48s |
0.49s |
| Check Time |
6.66s (± 0.43%) |
6.64s (± 0.36%) |
-0.01s (- 0.21%) |
6.57s |
6.69s |
| Emit Time |
2.49s (± 0.91%) |
2.49s (± 0.96%) |
-0.00s (- 0.12%) |
2.45s |
2.56s |
| Total Time |
10.57s (± 0.45%) |
10.46s (± 0.37%) |
-0.11s (- 1.01%) |
10.36s |
10.56s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,736k (± 0.01%) |
325,883k (± 0.01%) |
+147k (+ 0.05%) |
325,815k |
325,933k |
| Parse Time |
1.58s (± 0.79%) |
1.57s (± 0.82%) |
-0.00s (- 0.19%) |
1.55s |
1.61s |
| Bind Time |
0.78s (± 0.74%) |
0.72s (± 0.94%) |
🟩-0.06s (- 7.41%) |
0.72s |
0.75s |
| Check Time |
5.71s (± 0.61%) |
5.67s (± 0.51%) |
-0.03s (- 0.56%) |
5.61s |
5.74s |
| Emit Time |
3.37s (± 0.74%) |
3.36s (± 0.64%) |
-0.01s (- 0.42%) |
3.29s |
3.40s |
| Total Time |
11.44s (± 0.41%) |
11.33s (± 0.41%) |
-0.11s (- 0.93%) |
11.24s |
11.43s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,892k (± 0.01%) |
289,042k (± 0.01%) |
+151k (+ 0.05%) |
288,999k |
289,077k |
| Parse Time |
1.33s (± 1.47%) |
1.35s (± 1.87%) |
+0.02s (+ 1.20%) |
1.30s |
1.42s |
| Bind Time |
0.77s (± 4.58%) |
0.70s (± 5.24%) |
🟩-0.07s (- 9.13%) |
0.67s |
0.80s |
| Check Time |
5.36s (± 0.47%) |
5.33s (± 0.42%) |
-0.03s (- 0.52%) |
5.28s |
5.37s |
| Emit Time |
3.60s (± 2.46%) |
3.59s (± 2.42%) |
-0.00s (- 0.06%) |
3.42s |
3.72s |
| Total Time |
11.06s (± 0.70%) |
10.97s (± 0.84%) |
-0.09s (- 0.78%) |
10.80s |
11.17s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
446,583k (± 0.07%) |
447,031k (± 0.01%) |
+449k (+ 0.10%) |
446,972k |
447,122k |
| Parse Time |
1.88s (± 0.64%) |
1.85s (± 0.45%) |
-0.02s (- 1.12%) |
1.83s |
1.87s |
| Bind Time |
0.71s (± 1.06%) |
0.58s (± 0.69%) |
🟩-0.13s (-18.63%) |
0.57s |
0.59s |
| Check Time |
13.21s (± 0.80%) |
13.23s (± 0.66%) |
+0.02s (+ 0.14%) |
13.03s |
13.36s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.80s (± 0.70%) |
15.67s (± 0.56%) |
-0.14s (- 0.85%) |
15.47s |
15.80s |
| xstate - node (v14.15.1, x64) |
| Memory used |
541,782k (± 0.00%) |
542,234k (± 0.01%) |
+452k (+ 0.08%) |
542,191k |
542,292k |
| Parse Time |
2.62s (± 0.54%) |
2.60s (± 0.60%) |
-0.02s (- 0.69%) |
2.57s |
2.64s |
| Bind Time |
1.16s (± 1.60%) |
0.99s (± 0.88%) |
🟩-0.17s (-14.53%) |
0.97s |
1.01s |
| Check Time |
1.56s (± 0.39%) |
1.55s (± 0.56%) |
-0.01s (- 0.45%) |
1.53s |
1.56s |
| Emit Time |
0.08s (± 4.79%) |
0.07s (± 0.00%) |
🟩-0.01s (- 7.89%) |
0.07s |
0.07s |
| Total Time |
5.40s (± 0.48%) |
5.21s (± 0.43%) |
🟩-0.19s (- 3.50%) |
5.17s |
5.27s |
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 |
50225 |
10 |
| Baseline |
main |
10 |
Developer Information:Download Benchmark
|
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.
|
Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!
Here they are:
Comparison Report - main..50225
| Metric |
main |
50225 |
Delta |
Best |
Worst |
| Angular - node (v14.15.1, x64) |
| Memory used |
336,174k (± 0.01%) |
336,366k (± 0.00%) |
+191k (+ 0.06%) |
336,339k |
336,410k |
| Parse Time |
2.08s (± 1.12%) |
2.05s (± 0.61%) |
-0.03s (- 1.49%) |
2.04s |
2.08s |
| Bind Time |
0.89s (± 0.65%) |
0.78s (± 0.63%) |
🟩-0.11s (-12.21%) |
0.77s |
0.79s |
| Check Time |
5.81s (± 0.48%) |
5.81s (± 0.44%) |
+0.00s (+ 0.03%) |
5.76s |
5.86s |
| Emit Time |
6.38s (± 0.66%) |
6.44s (± 0.88%) |
+0.05s (+ 0.83%) |
6.31s |
6.57s |
| Total Time |
15.17s (± 0.49%) |
15.09s (± 0.49%) |
-0.08s (- 0.53%) |
14.91s |
15.21s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
191,796k (± 0.01%) |
191,946k (± 0.01%) |
+149k (+ 0.08%) |
191,904k |
191,990k |
| Parse Time |
0.85s (± 0.61%) |
0.85s (± 0.55%) |
-0.00s (- 0.12%) |
0.84s |
0.86s |
| Bind Time |
0.57s (± 1.66%) |
0.48s (± 0.62%) |
🟩-0.09s (-16.03%) |
0.48s |
0.49s |
| Check Time |
6.66s (± 0.43%) |
6.62s (± 0.95%) |
-0.04s (- 0.54%) |
6.53s |
6.83s |
| Emit Time |
2.49s (± 0.91%) |
2.49s (± 0.95%) |
+0.00s (+ 0.04%) |
2.43s |
2.54s |
| Total Time |
10.57s (± 0.45%) |
10.44s (± 0.64%) |
-0.13s (- 1.25%) |
10.32s |
10.67s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,736k (± 0.01%) |
325,870k (± 0.01%) |
+134k (+ 0.04%) |
325,841k |
325,931k |
| Parse Time |
1.58s (± 0.79%) |
1.58s (± 0.43%) |
-0.00s (- 0.13%) |
1.56s |
1.59s |
| Bind Time |
0.78s (± 0.74%) |
0.72s (± 0.51%) |
🟩-0.06s (- 7.41%) |
0.72s |
0.73s |
| Check Time |
5.71s (± 0.61%) |
5.70s (± 0.45%) |
-0.01s (- 0.14%) |
5.65s |
5.75s |
| Emit Time |
3.37s (± 0.74%) |
3.33s (± 0.56%) |
-0.04s (- 1.07%) |
3.29s |
3.37s |
| Total Time |
11.44s (± 0.41%) |
11.33s (± 0.36%) |
-0.11s (- 0.93%) |
11.24s |
11.42s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,892k (± 0.01%) |
289,058k (± 0.02%) |
+167k (+ 0.06%) |
288,956k |
289,188k |
| Parse Time |
1.33s (± 1.47%) |
1.34s (± 0.83%) |
+0.00s (+ 0.30%) |
1.30s |
1.35s |
| Bind Time |
0.77s (± 4.58%) |
0.69s (± 3.79%) |
🟩-0.08s (-10.56%) |
0.67s |
0.79s |
| Check Time |
5.36s (± 0.47%) |
5.35s (± 0.49%) |
-0.01s (- 0.28%) |
5.30s |
5.40s |
| Emit Time |
3.60s (± 2.46%) |
3.66s (± 2.16%) |
+0.07s (+ 1.84%) |
3.44s |
3.79s |
| Total Time |
11.06s (± 0.70%) |
11.03s (± 0.71%) |
-0.03s (- 0.27%) |
10.85s |
11.18s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
446,583k (± 0.07%) |
446,888k (± 0.06%) |
+306k (+ 0.07%) |
445,883k |
447,047k |
| Parse Time |
1.88s (± 0.64%) |
1.86s (± 0.36%) |
-0.02s (- 1.01%) |
1.84s |
1.87s |
| Bind Time |
0.71s (± 1.06%) |
0.58s (± 1.15%) |
🟩-0.13s (-18.77%) |
0.57s |
0.60s |
| Check Time |
13.21s (± 0.80%) |
13.24s (± 0.92%) |
+0.03s (+ 0.23%) |
12.96s |
13.60s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.80s (± 0.70%) |
15.68s (± 0.80%) |
-0.13s (- 0.79%) |
15.39s |
16.04s |
| xstate - node (v14.15.1, x64) |
| Memory used |
541,782k (± 0.00%) |
542,241k (± 0.01%) |
+459k (+ 0.08%) |
542,183k |
542,368k |
| Parse Time |
2.62s (± 0.54%) |
2.60s (± 0.55%) |
-0.01s (- 0.54%) |
2.58s |
2.65s |
| Bind Time |
1.16s (± 1.60%) |
0.98s (± 0.68%) |
🟩-0.18s (-15.48%) |
0.96s |
0.99s |
| Check Time |
1.56s (± 0.39%) |
1.55s (± 0.88%) |
-0.01s (- 0.32%) |
1.52s |
1.58s |
| Emit Time |
0.08s (± 4.79%) |
0.07s (± 0.00%) |
🟩-0.01s (- 7.89%) |
0.07s |
0.07s |
| Total Time |
5.40s (± 0.48%) |
5.21s (± 0.38%) |
🟩-0.19s (- 3.50%) |
5.16s |
5.26s |
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 |
50225 |
10 |
| Baseline |
main |
10 |
Developer Information:Download Benchmark
|
jakebailey 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.
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.
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.
|
Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!
Here they are:
Compiler
Comparison Report - main..50225
| Metric |
main |
50225 |
Delta |
Best |
Worst |
| Angular - node (v10.16.3, x64) |
| Memory used |
360,462k (± 0.02%) |
360,598k (± 0.02%) |
+136k (+ 0.04%) |
360,386k |
360,699k |
| Parse Time |
2.10s (± 0.42%) |
2.11s (± 0.52%) |
+0.01s (+ 0.38%) |
2.08s |
2.13s |
| Bind Time |
0.89s (± 1.00%) |
0.79s (± 0.66%) |
🟩-0.11s (-11.84%) |
0.78s |
0.80s |
| Check Time |
6.04s (± 0.53%) |
6.00s (± 0.53%) |
-0.03s (- 0.53%) |
5.93s |
6.07s |
| Emit Time |
6.16s (± 0.53%) |
6.20s (± 0.46%) |
+0.04s (+ 0.60%) |
6.13s |
6.24s |
| Total Time |
15.19s (± 0.32%) |
15.10s (± 0.30%) |
-0.09s (- 0.62%) |
14.98s |
15.18s |
| Compiler-Unions - node (v10.16.3, x64) |
| Memory used |
205,501k (± 0.04%) |
205,656k (± 0.05%) |
+155k (+ 0.08%) |
205,343k |
205,802k |
| Parse Time |
0.83s (± 0.94%) |
0.83s (± 0.59%) |
+0.01s (+ 0.60%) |
0.82s |
0.84s |
| Bind Time |
0.53s (± 1.66%) |
0.47s (± 1.32%) |
🟩-0.06s (-11.51%) |
0.46s |
0.48s |
| Check Time |
7.13s (± 0.61%) |
7.06s (± 0.39%) |
-0.08s (- 1.07%) |
6.99s |
7.12s |
| Emit Time |
2.51s (± 0.98%) |
2.54s (± 1.39%) |
+0.03s (+ 1.27%) |
2.46s |
2.61s |
| Total Time |
11.01s (± 0.52%) |
10.91s (± 0.47%) |
-0.10s (- 0.89%) |
10.80s |
10.99s |
| Monaco - node (v10.16.3, x64) |
| Memory used |
343,965k (± 0.02%) |
344,040k (± 0.01%) |
+75k (+ 0.02%) |
343,969k |
344,177k |
| Parse Time |
1.61s (± 0.62%) |
1.61s (± 0.84%) |
+0.00s (+ 0.12%) |
1.58s |
1.65s |
| Bind Time |
0.75s (± 0.59%) |
0.70s (± 0.57%) |
🟩-0.05s (- 7.05%) |
0.69s |
0.71s |
| Check Time |
5.99s (± 0.47%) |
6.00s (± 0.73%) |
+0.01s (+ 0.13%) |
5.91s |
6.12s |
| Emit Time |
3.27s (± 1.00%) |
3.29s (± 1.12%) |
+0.02s (+ 0.55%) |
3.23s |
3.41s |
| Total Time |
11.63s (± 0.51%) |
11.59s (± 0.48%) |
-0.03s (- 0.29%) |
11.45s |
11.71s |
| TFS - node (v10.16.3, x64) |
| Memory used |
305,274k (± 0.02%) |
305,432k (± 0.02%) |
+158k (+ 0.05%) |
305,211k |
305,523k |
| Parse Time |
1.29s (± 0.65%) |
1.29s (± 0.56%) |
+0.00s (+ 0.08%) |
1.27s |
1.30s |
| Bind Time |
0.72s (± 0.66%) |
0.67s (± 0.78%) |
🟩-0.05s (- 6.69%) |
0.66s |
0.68s |
| Check Time |
5.42s (± 0.58%) |
5.42s (± 0.55%) |
-0.00s (- 0.02%) |
5.37s |
5.49s |
| Emit Time |
3.45s (± 1.01%) |
3.51s (± 1.55%) |
+0.06s (+ 1.86%) |
3.39s |
3.68s |
| Total Time |
10.88s (± 0.41%) |
10.89s (± 0.38%) |
+0.01s (+ 0.10%) |
10.79s |
10.99s |
| material-ui - node (v10.16.3, x64) |
| Memory used |
469,523k (± 0.01%) |
469,785k (± 0.01%) |
+262k (+ 0.06%) |
469,680k |
469,933k |
| Parse Time |
1.84s (± 0.75%) |
1.83s (± 0.74%) |
-0.00s (- 0.27%) |
1.81s |
1.86s |
| Bind Time |
0.69s (± 1.69%) |
0.58s (± 1.93%) |
🟩-0.11s (-16.03%) |
0.56s |
0.60s |
| Check Time |
14.62s (± 0.68%) |
14.67s (± 0.73%) |
+0.06s (+ 0.38%) |
14.42s |
14.85s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
17.14s (± 0.62%) |
17.08s (± 0.64%) |
-0.06s (- 0.34%) |
16.82s |
17.26s |
| xstate - node (v10.16.3, x64) |
| Memory used |
578,547k (± 0.02%) |
579,026k (± 0.01%) |
+479k (+ 0.08%) |
578,809k |
579,168k |
| Parse Time |
2.62s (± 0.43%) |
2.61s (± 0.38%) |
-0.00s (- 0.19%) |
2.58s |
2.62s |
| Bind Time |
1.03s (± 1.14%) |
0.88s (± 0.59%) |
🟩-0.15s (-14.55%) |
0.87s |
0.89s |
| Check Time |
1.57s (± 0.56%) |
1.58s (± 0.52%) |
+0.00s (+ 0.25%) |
1.56s |
1.59s |
| Emit Time |
0.07s (± 0.00%) |
0.07s (± 3.14%) |
+0.00s (+ 1.43%) |
0.07s |
0.08s |
| Total Time |
5.29s (± 0.34%) |
5.13s (± 0.35%) |
-0.16s (- 2.97%) |
5.09s |
5.16s |
| Angular - node (v12.1.0, x64) |
| Memory used |
338,015k (± 0.03%) |
338,138k (± 0.01%) |
+123k (+ 0.04%) |
338,033k |
338,229k |
| Parse Time |
2.08s (± 0.42%) |
2.10s (± 0.50%) |
+0.01s (+ 0.72%) |
2.07s |
2.12s |
| Bind Time |
0.86s (± 0.95%) |
0.76s (± 0.58%) |
🟩-0.10s (-11.40%) |
0.75s |
0.77s |
| Check Time |
5.88s (± 0.82%) |
5.84s (± 0.52%) |
-0.04s (- 0.65%) |
5.79s |
5.91s |
| Emit Time |
6.38s (± 0.65%) |
6.45s (± 0.53%) |
+0.06s (+ 0.99%) |
6.36s |
6.51s |
| Total Time |
15.21s (± 0.56%) |
15.15s (± 0.36%) |
-0.06s (- 0.41%) |
15.05s |
15.27s |
| Compiler-Unions - node (v12.1.0, x64) |
| Memory used |
193,299k (± 0.02%) |
193,336k (± 0.03%) |
+37k (+ 0.02%) |
193,166k |
193,456k |
| Parse Time |
0.82s (± 0.94%) |
0.82s (± 0.72%) |
+0.00s (+ 0.37%) |
0.81s |
0.84s |
| Bind Time |
0.55s (± 1.39%) |
0.47s (± 0.72%) |
🟩-0.07s (-13.37%) |
0.47s |
0.48s |
| Check Time |
6.67s (± 0.71%) |
6.62s (± 0.44%) |
-0.05s (- 0.79%) |
6.56s |
6.70s |
| Emit Time |
2.57s (± 1.31%) |
2.53s (± 1.01%) |
-0.03s (- 1.32%) |
2.49s |
2.60s |
| Total Time |
10.61s (± 0.36%) |
10.45s (± 0.31%) |
-0.16s (- 1.46%) |
10.40s |
10.53s |
| Monaco - node (v12.1.0, x64) |
| Memory used |
326,984k (± 0.03%) |
327,092k (± 0.01%) |
+108k (+ 0.03%) |
327,009k |
327,235k |
| Parse Time |
1.57s (± 0.60%) |
1.57s (± 0.52%) |
+0.00s (+ 0.19%) |
1.56s |
1.59s |
| Bind Time |
0.75s (± 0.67%) |
0.70s (± 0.93%) |
🟩-0.05s (- 6.31%) |
0.68s |
0.71s |
| Check Time |
5.81s (± 0.52%) |
5.81s (± 0.52%) |
-0.00s (- 0.02%) |
5.75s |
5.88s |
| Emit Time |
3.30s (± 0.76%) |
3.30s (± 0.68%) |
-0.00s (- 0.06%) |
3.25s |
3.34s |
| Total Time |
11.42s (± 0.37%) |
11.37s (± 0.40%) |
-0.05s (- 0.39%) |
11.29s |
11.49s |
| TFS - node (v12.1.0, x64) |
| Memory used |
289,858k (± 0.02%) |
289,991k (± 0.02%) |
+133k (+ 0.05%) |
289,843k |
290,124k |
| Parse Time |
1.30s (± 0.74%) |
1.29s (± 0.53%) |
-0.01s (- 0.54%) |
1.28s |
1.31s |
| Bind Time |
0.72s (± 0.90%) |
0.66s (± 0.98%) |
🟩-0.06s (- 7.80%) |
0.65s |
0.68s |
| Check Time |
5.37s (± 0.40%) |
5.40s (± 0.38%) |
+0.02s (+ 0.45%) |
5.33s |
5.43s |
| Emit Time |
3.52s (± 0.90%) |
3.55s (± 0.71%) |
+0.03s (+ 0.77%) |
3.48s |
3.59s |
| Total Time |
10.91s (± 0.25%) |
10.90s (± 0.34%) |
-0.01s (- 0.10%) |
10.83s |
10.99s |
| material-ui - node (v12.1.0, x64) |
| Memory used |
448,382k (± 0.08%) |
448,832k (± 0.02%) |
+450k (+ 0.10%) |
448,650k |
449,022k |
| Parse Time |
1.82s (± 0.45%) |
1.81s (± 0.71%) |
-0.01s (- 0.55%) |
1.78s |
1.84s |
| Bind Time |
0.67s (± 0.54%) |
0.55s (± 1.06%) |
🟩-0.13s (-18.84%) |
0.54s |
0.56s |
| Check Time |
13.10s (± 0.93%) |
13.08s (± 0.77%) |
-0.01s (- 0.08%) |
12.93s |
13.35s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.59s (± 0.77%) |
15.44s (± 0.68%) |
-0.14s (- 0.92%) |
15.27s |
15.74s |
| xstate - node (v12.1.0, x64) |
| Memory used |
547,270k (± 1.33%) |
544,405k (± 0.02%) |
-2,865k (- 0.52%) |
544,267k |
544,608k |
| Parse Time |
2.56s (± 0.77%) |
2.55s (± 0.66%) |
-0.02s (- 0.74%) |
2.51s |
2.59s |
| Bind Time |
1.02s (± 1.32%) |
0.87s (± 0.38%) |
🟩-0.15s (-14.29%) |
0.86s |
0.88s |
| Check Time |
1.51s (± 0.54%) |
1.52s (± 0.82%) |
+0.01s (+ 0.79%) |
1.50s |
1.55s |
| Emit Time |
0.07s (± 0.00%) |
0.07s (± 0.00%) |
0.00s ( 0.00%) |
0.07s |
0.07s |
| Total Time |
5.17s (± 0.51%) |
5.01s (± 0.42%) |
🟩-0.16s (- 3.10%) |
4.95s |
5.05s |
| Angular - node (v14.15.1, x64) |
| Memory used |
336,174k (± 0.01%) |
336,383k (± 0.01%) |
+209k (+ 0.06%) |
336,331k |
336,466k |
| Parse Time |
2.08s (± 1.12%) |
2.05s (± 0.62%) |
-0.03s (- 1.54%) |
2.02s |
2.08s |
| Bind Time |
0.89s (± 0.65%) |
0.78s (± 0.63%) |
🟩-0.11s (-12.21%) |
0.77s |
0.79s |
| Check Time |
5.81s (± 0.48%) |
5.83s (± 0.43%) |
+0.01s (+ 0.24%) |
5.78s |
5.90s |
| Emit Time |
6.38s (± 0.66%) |
6.43s (± 1.00%) |
+0.04s (+ 0.69%) |
6.33s |
6.65s |
| Total Time |
15.17s (± 0.49%) |
15.09s (± 0.46%) |
-0.08s (- 0.53%) |
14.97s |
15.30s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
191,796k (± 0.01%) |
191,936k (± 0.02%) |
+140k (+ 0.07%) |
191,878k |
192,013k |
| Parse Time |
0.85s (± 0.61%) |
0.85s (± 0.52%) |
+0.00s (+ 0.12%) |
0.84s |
0.86s |
| Bind Time |
0.57s (± 1.66%) |
0.49s (± 1.56%) |
🟩-0.09s (-15.33%) |
0.48s |
0.51s |
| Check Time |
6.66s (± 0.43%) |
6.65s (± 0.81%) |
-0.00s (- 0.05%) |
6.55s |
6.78s |
| Emit Time |
2.49s (± 0.91%) |
2.50s (± 0.60%) |
+0.01s (+ 0.36%) |
2.47s |
2.54s |
| Total Time |
10.57s (± 0.45%) |
10.49s (± 0.51%) |
-0.08s (- 0.79%) |
10.37s |
10.59s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,736k (± 0.01%) |
325,871k (± 0.01%) |
+135k (+ 0.04%) |
325,825k |
325,916k |
| Parse Time |
1.58s (± 0.79%) |
1.58s (± 0.66%) |
+0.00s (+ 0.19%) |
1.56s |
1.60s |
| Bind Time |
0.78s (± 0.74%) |
0.72s (± 0.82%) |
🟩-0.06s (- 7.54%) |
0.71s |
0.73s |
| Check Time |
5.71s (± 0.61%) |
5.69s (± 0.37%) |
-0.01s (- 0.23%) |
5.65s |
5.76s |
| Emit Time |
3.37s (± 0.74%) |
3.38s (± 0.83%) |
+0.01s (+ 0.18%) |
3.33s |
3.44s |
| Total Time |
11.44s (± 0.41%) |
11.37s (± 0.29%) |
-0.06s (- 0.57%) |
11.31s |
11.46s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,892k (± 0.01%) |
289,053k (± 0.01%) |
+161k (+ 0.06%) |
289,000k |
289,109k |
| Parse Time |
1.33s (± 1.47%) |
1.35s (± 1.92%) |
+0.02s (+ 1.35%) |
1.29s |
1.40s |
| Bind Time |
0.77s (± 4.58%) |
0.70s (± 4.74%) |
🟩-0.06s (- 8.08%) |
0.66s |
0.80s |
| Check Time |
5.36s (± 0.47%) |
5.34s (± 0.53%) |
-0.02s (- 0.39%) |
5.28s |
5.42s |
| Emit Time |
3.60s (± 2.46%) |
3.61s (± 1.79%) |
+0.01s (+ 0.39%) |
3.46s |
3.73s |
| Total Time |
11.06s (± 0.70%) |
11.00s (± 0.59%) |
-0.06s (- 0.52%) |
10.89s |
11.10s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
446,583k (± 0.07%) |
446,895k (± 0.05%) |
+312k (+ 0.07%) |
445,932k |
447,068k |
| Parse Time |
1.88s (± 0.64%) |
1.87s (± 0.32%) |
-0.01s (- 0.53%) |
1.85s |
1.88s |
| Bind Time |
0.71s (± 1.06%) |
0.58s (± 0.38%) |
🟩-0.14s (-18.91%) |
0.57s |
0.58s |
| Check Time |
13.21s (± 0.80%) |
13.31s (± 0.79%) |
+0.10s (+ 0.73%) |
13.16s |
13.67s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.80s (± 0.70%) |
15.75s (± 0.68%) |
-0.05s (- 0.32%) |
15.61s |
16.12s |
| xstate - node (v14.15.1, x64) |
| Memory used |
541,782k (± 0.00%) |
542,276k (± 0.01%) |
+494k (+ 0.09%) |
542,202k |
542,338k |
| Parse Time |
2.62s (± 0.54%) |
2.60s (± 0.55%) |
-0.01s (- 0.54%) |
2.58s |
2.64s |
| Bind Time |
1.16s (± 1.60%) |
0.98s (± 0.86%) |
🟩-0.18s (-15.14%) |
0.97s |
1.01s |
| Check Time |
1.56s (± 0.39%) |
1.56s (± 0.60%) |
+0.00s (+ 0.19%) |
1.53s |
1.57s |
| Emit Time |
0.08s (± 4.79%) |
0.07s (± 3.14%) |
🟩-0.01s (- 6.58%) |
0.07s |
0.08s |
| Total Time |
5.40s (± 0.48%) |
5.22s (± 0.43%) |
🟩-0.18s (- 3.26%) |
5.15s |
5.25s |
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 |
50225 |
10 |
| Baseline |
main |
10 |
TSServer
Comparison Report - main..50225
| Metric |
main |
50225 |
Delta |
Best |
Worst |
| Compiler-UnionsTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
1,460ms (± 0.53%) |
1,394ms (± 0.47%) |
🟩-66ms (- 4.53%) |
1,385ms |
1,416ms |
| Req 2 - geterr |
3,619ms (± 0.35%) |
3,569ms (± 0.57%) |
-50ms (- 1.38%) |
3,510ms |
3,601ms |
| Req 3 - references |
280ms (± 1.76%) |
227ms (± 0.52%) |
🟩-53ms (-18.80%) |
224ms |
230ms |
| Req 4 - navto |
235ms (± 0.92%) |
172ms (± 1.16%) |
🟩-63ms (-26.68%) |
169ms |
179ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
63ms (± 4.43%) |
67ms (± 4.15%) |
+4ms (+ 6.20%) |
60ms |
71ms |
| CompilerTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
1,562ms (± 0.68%) |
1,489ms (± 0.59%) |
🟩-73ms (- 4.65%) |
1,464ms |
1,502ms |
| Req 2 - geterr |
2,288ms (± 0.43%) |
2,227ms (± 0.22%) |
-61ms (- 2.67%) |
2,218ms |
2,237ms |
| Req 3 - references |
301ms (± 1.74%) |
241ms (± 0.58%) |
🟩-59ms (-19.77%) |
240ms |
246ms |
| Req 4 - navto |
237ms (± 1.74%) |
186ms (± 1.04%) |
🟩-51ms (-21.42%) |
182ms |
189ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
69ms (± 1.43%) |
69ms (± 2.22%) |
-0ms (- 0.15%) |
64ms |
71ms |
| xstateTSServer - node (v10.16.3, x64) |
| Req 1 - updateOpen |
2,179ms (± 0.42%) |
2,071ms (± 0.53%) |
🟩-109ms (- 4.98%) |
2,051ms |
2,092ms |
| Req 2 - geterr |
776ms (± 0.78%) |
777ms (± 0.70%) |
+1ms (+ 0.15%) |
766ms |
789ms |
| Req 3 - references |
97ms (± 1.58%) |
98ms (± 1.41%) |
+1ms (+ 0.51%) |
95ms |
100ms |
| Req 4 - navto |
254ms (± 0.91%) |
232ms (± 0.59%) |
🟩-21ms (- 8.36%) |
229ms |
235ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
273ms (± 1.17%) |
266ms (± 1.18%) |
-6ms (- 2.31%) |
259ms |
273ms |
| Compiler-UnionsTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
1,477ms (± 0.79%) |
1,398ms (± 0.67%) |
🟩-79ms (- 5.38%) |
1,380ms |
1,419ms |
| Req 2 - geterr |
3,402ms (± 0.61%) |
3,341ms (± 0.57%) |
-61ms (- 1.79%) |
3,317ms |
3,387ms |
| Req 3 - references |
261ms (± 0.68%) |
218ms (± 0.96%) |
🟩-43ms (-16.31%) |
213ms |
223ms |
| Req 4 - navto |
205ms (± 0.82%) |
160ms (± 0.69%) |
🟩-44ms (-21.56%) |
159ms |
163ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
74ms (±13.16%) |
63ms (±12.61%) |
🟩-12ms (-15.73%) |
55ms |
84ms |
| CompilerTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
1,559ms (± 0.59%) |
1,488ms (± 0.53%) |
🟩-72ms (- 4.59%) |
1,474ms |
1,509ms |
| Req 2 - geterr |
2,209ms (± 0.48%) |
2,167ms (± 0.46%) |
-42ms (- 1.89%) |
2,143ms |
2,195ms |
| Req 3 - references |
273ms (± 0.67%) |
233ms (± 0.66%) |
🟩-40ms (-14.67%) |
229ms |
236ms |
| Req 4 - navto |
215ms (± 0.57%) |
172ms (± 1.17%) |
🟩-44ms (-20.31%) |
168ms |
178ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
64ms (± 3.74%) |
63ms (± 4.16%) |
-1ms (- 1.57%) |
54ms |
66ms |
| xstateTSServer - node (v12.1.0, x64) |
| Req 1 - updateOpen |
2,100ms (± 0.68%) |
2,010ms (± 0.56%) |
🟩-90ms (- 4.28%) |
1,988ms |
2,035ms |
| Req 2 - geterr |
761ms (± 0.65%) |
761ms (± 0.40%) |
+0ms (+ 0.05%) |
754ms |
767ms |
| Req 3 - references |
65ms (± 1.12%) |
65ms (± 1.72%) |
-0ms (- 0.31%) |
62ms |
67ms |
| Req 4 - navto |
242ms (± 1.35%) |
225ms (± 1.37%) |
🟩-17ms (- 6.99%) |
215ms |
230ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
265ms (± 1.41%) |
267ms (± 1.17%) |
+1ms (+ 0.41%) |
259ms |
272ms |
| Compiler-UnionsTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
1,527ms (± 0.67%) |
1,442ms (± 0.73%) |
🟩-86ms (- 5.61%) |
1,420ms |
1,464ms |
| Req 2 - geterr |
3,534ms (± 0.52%) |
3,506ms (± 0.39%) |
-28ms (- 0.79%) |
3,472ms |
3,537ms |
| Req 3 - references |
276ms (± 0.48%) |
229ms (± 0.48%) |
🟩-48ms (-17.19%) |
227ms |
231ms |
| Req 4 - navto |
217ms (± 0.43%) |
167ms (± 0.75%) |
🟩-50ms (-22.93%) |
165ms |
171ms |
| Req 5 - completionInfo count |
1,355 (± 0.00%) |
1,355 (± 0.00%) |
0 ( 0.00%) |
1,355 |
1,355 |
| Req 5 - completionInfo |
57ms (± 5.74%) |
57ms (± 3.69%) |
-0ms (- 0.70%) |
55ms |
65ms |
| CompilerTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
1,605ms (± 0.61%) |
1,506ms (± 0.47%) |
🟩-99ms (- 6.18%) |
1,488ms |
1,517ms |
| Req 2 - geterr |
2,341ms (± 0.58%) |
2,295ms (± 0.45%) |
-46ms (- 1.98%) |
2,269ms |
2,315ms |
| Req 3 - references |
286ms (± 0.79%) |
241ms (± 0.55%) |
🟩-45ms (-15.66%) |
238ms |
244ms |
| Req 4 - navto |
235ms (± 2.59%) |
179ms (± 0.46%) |
🟩-56ms (-23.80%) |
177ms |
181ms |
| Req 5 - completionInfo count |
1,517 (± 0.00%) |
1,517 (± 0.00%) |
0 ( 0.00%) |
1,517 |
1,517 |
| Req 5 - completionInfo |
54ms (± 1.52%) |
53ms (± 1.47%) |
-1ms (- 1.49%) |
52ms |
55ms |
| xstateTSServer - node (v14.15.1, x64) |
| Req 1 - updateOpen |
2,228ms (± 0.37%) |
2,133ms (± 0.38%) |
🟩-96ms (- 4.29%) |
2,113ms |
2,153ms |
| Req 2 - geterr |
783ms (± 0.51%) |
782ms (± 0.54%) |
-1ms (- 0.14%) |
774ms |
790ms |
| Req 3 - references |
68ms (± 9.45%) |
64ms (± 1.32%) |
🟩-4ms (- 5.87%) |
62ms |
66ms |
| Req 4 - navto |
249ms (± 0.77%) |
231ms (± 0.69%) |
🟩-18ms (- 7.22%) |
228ms |
234ms |
| Req 5 - completionInfo count |
3,244 (± 0.00%) |
3,244 (± 0.00%) |
0 ( 0.00%) |
3,244 |
3,244 |
| Req 5 - completionInfo |
267ms (± 0.47%) |
268ms (± 0.93%) |
+1ms (+ 0.45%) |
263ms |
276ms |
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 |
50225 |
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 wonder if the same benefit could be found in visitEachChild as well, or potentially any of the main visitor functions in each transformer. This does create an array with quite a bit of empty space due to how many tokens don't have or need a visitor. I wonder if an object literal would have better or worse performance metrics, i.e.:
const forEachChildTable: Partial<Record<SyntaxKind, ForEachChildFunction>> = {
[SyntaxKind.QualifiedName]: forEachQualifiedName,
[SyntaxKind.TypeParameter]: forEachTypeParameter,
// etc.
};
|
DanielRosenwasser reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I wonder if an object literal would have better or worse performance metrics,
If an object has identical perf, then I'd assume it's an indication that the array being constructed is sparse - but we need the look-up to be fast. If there's an easy way to create a definitely-packed array, then I'll switch to it here.
All the tests do admittedly indicate higher memory usage - but more than I would've expected.
I wonder if the same benefit could be found in visitEachChild as well
It's definitely worth playing with, especially since visitEachChild tends to be pretty much identical to forEachChild. I don't currently see a difference with checkExpressionWorker though, but I'm playing with it over at #50228.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binding isn't very important as a percentage of tsc execution time, but this should help in editor scenarios where we rebind regularly.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
@@ -95,6 +95,979 @@ namespace ts { |
|
|
return isMetaProperty(node) && node.keywordToken === SyntaxKind.ImportKeyword && node.name.escapedText === "meta";
|
|
|
}
|
|
|
|
|
|
type ForEachChildFunction = <T>(node: any, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined) => T | undefined;
|
|
|
|
|
|
const forEachChildTable = new Array<ForEachChildFunction>(SyntaxKind.Count);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts on this initialization mechanism:
- AFAIK, the ctor arg does nothing (Jake Bailey (@jakebailey)?)
- The array will always be sparse (among other things, we're always skipping the first 160 elements)
- We don't have any protection against specifying two different functions for the same kind.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, AFAIK the size argument doesn't actually make this a compact array or anything, hence them trying to add a Array.withCapacity instead or something.
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.
|
It sounds like Ron and Jake are both on board with introducing an internal HasChildren type, and then using an object to enforce that everything is set correctly. I think that's a good idea, and we could always swap around the implementations if we don't like these.
So I think we should get one more sign-off on Ron's change first at #50266. Once that's in, I'll update this PR to leverage the same HasChildren trick.
|
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.
|
Because integration with the HasChildren union is such a pain - because forEachChild doesn't account for Identifiers with children, and because visitEachChild doesn't account for any JSDoc nodes - I'm going to defer it to a different PR.
I want to be able to untangle the perf wins here with whatever new stuff that might introduce.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+758
to
+759
|
|
// TODO: should we separate these branches out?
|
|
|
visitNode(cbNode, (node as CallExpression).questionDotToken) ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this for a follow-up change.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!
Here they are:
Comparison Report - main..50225
| Metric |
main |
50225 |
Delta |
Best |
Worst |
| Angular - node (v14.15.1, x64) |
| Memory used |
337,622k (± 0.08%) |
337,931k (± 0.01%) |
+309k (+ 0.09%) |
337,884k |
337,998k |
| Parse Time |
2.08s (± 0.74%) |
2.06s (± 0.56%) |
-0.01s (- 0.63%) |
2.04s |
2.09s |
| Bind Time |
0.91s (± 0.82%) |
0.80s (± 0.75%) |
🟩-0.11s (-12.24%) |
0.78s |
0.81s |
| Check Time |
5.85s (± 0.60%) |
5.80s (± 0.39%) |
-0.05s (- 0.80%) |
5.75s |
5.85s |
| Emit Time |
6.19s (± 0.97%) |
6.16s (± 0.51%) |
-0.03s (- 0.44%) |
6.10s |
6.23s |
| Total Time |
15.02s (± 0.64%) |
14.82s (± 0.26%) |
-0.20s (- 1.30%) |
14.77s |
14.94s |
| Compiler-Unions - node (v14.15.1, x64) |
| Memory used |
192,339k (± 0.38%) |
192,118k (± 0.03%) |
-221k (- 0.12%) |
192,019k |
192,236k |
| Parse Time |
0.85s (± 0.78%) |
0.85s (± 0.55%) |
-0.00s (- 0.35%) |
0.84s |
0.86s |
| Bind Time |
0.58s (± 0.69%) |
0.49s (± 0.75%) |
🟩-0.09s (-16.06%) |
0.48s |
0.49s |
| Check Time |
6.92s (± 0.49%) |
6.86s (± 0.78%) |
-0.06s (- 0.80%) |
6.69s |
6.94s |
| Emit Time |
2.42s (± 1.12%) |
2.41s (± 0.88%) |
-0.01s (- 0.29%) |
2.37s |
2.46s |
| Total Time |
10.77s (± 0.45%) |
10.61s (± 0.54%) |
-0.16s (- 1.46%) |
10.41s |
10.70s |
| Monaco - node (v14.15.1, x64) |
| Memory used |
325,884k (± 0.01%) |
326,027k (± 0.01%) |
+143k (+ 0.04%) |
325,967k |
326,068k |
| Parse Time |
1.58s (± 0.89%) |
1.57s (± 0.79%) |
-0.01s (- 0.51%) |
1.55s |
1.61s |
| Bind Time |
0.78s (± 0.79%) |
0.72s (± 0.77%) |
🟩-0.06s (- 7.83%) |
0.71s |
0.73s |
| Check Time |
5.69s (± 0.31%) |
5.68s (± 0.42%) |
-0.01s (- 0.16%) |
5.65s |
5.75s |
| Emit Time |
3.31s (± 0.56%) |
3.33s (± 0.76%) |
+0.01s (+ 0.42%) |
3.28s |
3.38s |
| Total Time |
11.37s (± 0.31%) |
11.30s (± 0.40%) |
-0.06s (- 0.54%) |
11.22s |
11.42s |
| TFS - node (v14.15.1, x64) |
| Memory used |
288,966k (± 0.01%) |
289,104k (± 0.01%) |
+138k (+ 0.05%) |
289,039k |
289,146k |
| Parse Time |
1.37s (± 1.93%) |
1.31s (± 1.19%) |
🟩-0.05s (- 3.88%) |
1.29s |
1.35s |
| Bind Time |
0.74s (± 3.31%) |
0.72s (± 5.24%) |
🟩-0.02s (- 3.22%) |
0.67s |
0.81s |
| Check Time |
5.36s (± 0.61%) |
5.34s (± 0.39%) |
-0.02s (- 0.35%) |
5.29s |
5.39s |
| Emit Time |
3.55s (± 2.02%) |
3.54s (± 2.28%) |
-0.01s (- 0.37%) |
3.37s |
3.70s |
| Total Time |
11.03s (± 0.95%) |
10.92s (± 0.82%) |
-0.11s (- 0.98%) |
10.71s |
11.12s |
| material-ui - node (v14.15.1, x64) |
| Memory used |
450,366k (± 0.01%) |
450,545k (± 0.01%) |
+179k (+ 0.04%) |
450,487k |
450,596k |
| Parse Time |
1.87s (± 0.78%) |
1.86s (± 0.69%) |
-0.02s (- 0.91%) |
1.84s |
1.90s |
| Bind Time |
0.72s (± 0.69%) |
0.58s (± 0.51%) |
🟩-0.14s (-19.27%) |
0.57s |
0.58s |
| Check Time |
13.11s (± 0.44%) |
13.14s (± 0.48%) |
+0.03s (+ 0.23%) |
13.04s |
13.32s |
| Emit Time |
0.00s (± 0.00%) |
0.00s (± 0.00%) |
0.00s ( NaN%) |
0.00s |
0.00s |
| Total Time |
15.70s (± 0.39%) |
15.57s (± 0.43%) |
-0.13s (- 0.80%) |
15.47s |
15.76s |
| xstate - node (v14.15.1, x64) |
| Memory used |
545,787k (± 0.00%) |
546,241k (± 0.00%) |
+454k (+ 0.08%) |
546,182k |
546,293k |
| Parse Time |
2.61s (± 0.42%) |
2.59s (± 0.48%) |
-0.01s (- 0.50%) |
2.57s |
2.63s |
| Bind Time |
1.14s (± 0.76%) |
0.98s (± 1.31%) |
🟩-0.16s (-14.19%) |
0.96s |
1.00s |
| Check Time |
1.55s (± 0.43%) |
1.55s (± 0.49%) |
-0.01s (- 0.45%) |
1.53s |
1.57s |
| Emit Time |
0.08s (± 4.42%) |
0.07s (± 4.66%) |
🟩-0.00s (- 5.19%) |
0.07s |
0.08s |
| Total Time |
5.37s (± 0.36%) |
5.20s (± 0.30%) |
🟩-0.18s (- 3.29%) |
5.17s |
5.23s |
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 |
50225 |
10 |
| Baseline |
main |
10 |
Developer Information:Download Benchmark
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Those perf results make me happy every time I see them.
|
DanielRosenwasser reacted with heart emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+697
to
+703
|
|
node.typeExpression.kind === SyntaxKind.JSDocTypeExpression
|
|
|
? visitNode(cbNode, node.typeExpression) ||
|
|
|
visitNode(cbNode, node.fullName) ||
|
|
|
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
|
|
|
: visitNode(cbNode, node.fullName) ||
|
|
|
visitNode(cbNode, node.typeExpression) ||
|
|
|
(typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation here makes it a bit difficult to read.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
DanielRosenwasser and SlurpTheo reacted with thumbs up emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's awful - but I believe it's from the original code. I'll fix it up in the HasChildren PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I have some lints I have to fix so... I guess I'll fix now.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Dec 9, 2022
|
This was a welcome addition. Nice work Daniel Rosenwasser (@DanielRosenwasser)
I'm just going to leave this here as something I've noticed. About enums, switches and performance in V8.
V8 doesn't like switches with enums, it does however deal with const enums very differently. I wonder what would happen if the SyntaxKind enum was made into a const enum (and you kept the switch). Changing the SyntaxKind enum into a cost enum creates other problems but I think the performance "problem" with the switch statement has more to do so that it isn't being generated into a jump table in machine code when you don't use literal integer numbers (SMIs) as case labels.
I don't remember the exact number but I had a switch with 250+ cases in it and when I changed from enum to const enum it made a huge difference.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
[...] I wonder what would happen if the SyntaxKind enum was made into a const enum (and you kept the switch).
SyntaxKind is defined as a const enum internally, so it was using literal integers for case labels. It's likely we were running afoul of some other issue that resulted in a suboptimal compiled representation.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
[...] I wonder what would happen if the SyntaxKind enum was made into a const enum (and you kept the switch).
SyntaxKind is defined as a const enum internally, so it was using literal integers for case labels. It's likely we were running afoul of some other issue that resulted in a suboptimal compiled representation.
Oh really, interesting! Thanks for letting me know.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+2 more reviewers
Reviewers whose approvals may not affect merge requirements
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.
|