GeezerVison is showing github.com — Add constructor functions for {Symbol,Node}Links by Swatinem · Pull Request #36845 · microsoft/TypeScript
Conversation
Using a constructor function like this can help node better optimize
object allocation. This improves memory usage when compiling
src/compiler from 277M to 270M, a nice ~3% win.
Inspired by #33431, looking how far I can take this.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
priscilawebdev and ExE-Boss 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.
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.
|
Nathan Shively-Sanders (@sandersn)
The results of the perf run you requested are in!
Here they are:
Comparison Report - master..36845
| Metric |
master |
36845 |
Delta |
Best |
Worst |
| Angular - node (v10.16.3, x64) |
| Memory used |
333,999k (± 0.02%) |
327,638k (± 0.03%) |
-6,362k (- 1.90%) |
327,383k |
327,747k |
| Parse Time |
1.62s (± 0.57%) |
1.61s (± 0.31%) |
-0.00s (- 0.25%) |
1.61s |
1.63s |
| Bind Time |
0.89s (± 1.35%) |
0.89s (± 1.40%) |
+0.00s (+ 0.34%) |
0.86s |
0.92s |
| Check Time |
4.70s (± 0.58%) |
4.68s (± 0.57%) |
-0.02s (- 0.45%) |
4.62s |
4.74s |
| Emit Time |
5.24s (± 1.09%) |
5.24s (± 0.54%) |
-0.00s (- 0.02%) |
5.18s |
5.30s |
| Total Time |
12.45s (± 0.72%) |
12.42s (± 0.48%) |
-0.03s (- 0.20%) |
12.31s |
12.55s |
| Monaco - node (v10.16.3, x64) |
| Memory used |
335,204k (± 0.02%) |
328,482k (± 0.02%) |
-6,722k (- 2.01%) |
328,304k |
328,575k |
| Parse Time |
1.25s (± 0.52%) |
1.25s (± 0.42%) |
-0.00s (- 0.24%) |
1.24s |
1.26s |
| Bind Time |
0.77s (± 0.47%) |
0.78s (± 0.48%) |
+0.00s (+ 0.13%) |
0.77s |
0.78s |
| Check Time |
4.70s (± 0.31%) |
4.70s (± 0.52%) |
-0.00s (- 0.02%) |
4.65s |
4.75s |
| Emit Time |
2.93s (± 0.97%) |
2.91s (± 0.65%) |
-0.03s (- 0.92%) |
2.88s |
2.97s |
| Total Time |
9.66s (± 0.46%) |
9.64s (± 0.39%) |
-0.02s (- 0.25%) |
9.57s |
9.72s |
| TFS - node (v10.16.3, x64) |
| Memory used |
299,386k (± 0.02%) |
292,892k (± 0.02%) |
-6,494k (- 2.17%) |
292,794k |
293,012k |
| Parse Time |
0.94s (± 0.66%) |
0.94s (± 0.79%) |
-0.00s (- 0.11%) |
0.92s |
0.95s |
| Bind Time |
0.74s (± 0.75%) |
0.74s (± 0.78%) |
+0.00s (+ 0.13%) |
0.73s |
0.75s |
| Check Time |
4.26s (± 0.31%) |
4.21s (± 0.59%) |
-0.05s (- 1.08%) |
4.17s |
4.29s |
| Emit Time |
3.03s (± 0.38%) |
3.02s (± 0.71%) |
-0.01s (- 0.36%) |
2.96s |
3.06s |
| Total Time |
8.97s (± 0.11%) |
8.92s (± 0.56%) |
-0.06s (- 0.65%) |
8.82s |
9.01s |
| Angular - node (v12.1.0, x64) |
| Memory used |
309,651k (± 0.08%) |
303,314k (± 0.07%) |
-6,337k (- 2.05%) |
302,539k |
303,590k |
| Parse Time |
1.57s (± 0.72%) |
1.57s (± 0.59%) |
+0.00s (+ 0.19%) |
1.55s |
1.59s |
| Bind Time |
0.87s (± 0.79%) |
0.87s (± 0.80%) |
+0.01s (+ 0.58%) |
0.86s |
0.89s |
| Check Time |
4.59s (± 0.49%) |
4.62s (± 0.47%) |
+0.02s (+ 0.48%) |
4.56s |
4.66s |
| Emit Time |
5.43s (± 1.15%) |
5.41s (± 0.59%) |
-0.03s (- 0.52%) |
5.33s |
5.47s |
| Total Time |
12.46s (± 0.62%) |
12.47s (± 0.26%) |
+0.01s (+ 0.05%) |
12.41s |
12.56s |
| Monaco - node (v12.1.0, x64) |
| Memory used |
315,078k (± 0.02%) |
308,439k (± 0.02%) |
-6,639k (- 2.11%) |
308,280k |
308,629k |
| Parse Time |
1.20s (± 0.83%) |
1.20s (± 0.55%) |
0.00s ( 0.00%) |
1.19s |
1.22s |
| Bind Time |
0.74s (± 0.54%) |
0.74s (± 1.02%) |
+0.00s (+ 0.40%) |
0.73s |
0.76s |
| Check Time |
4.55s (± 0.49%) |
4.53s (± 0.56%) |
-0.03s (- 0.64%) |
4.46s |
4.58s |
| Emit Time |
2.94s (± 0.70%) |
2.94s (± 0.88%) |
+0.00s (+ 0.14%) |
2.88s |
2.98s |
| Total Time |
9.43s (± 0.35%) |
9.41s (± 0.44%) |
-0.02s (- 0.22%) |
9.32s |
9.52s |
| TFS - node (v12.1.0, x64) |
| Memory used |
281,661k (± 0.02%) |
275,187k (± 0.02%) |
-6,474k (- 2.30%) |
275,064k |
275,262k |
| Parse Time |
0.92s (± 0.84%) |
0.92s (± 0.49%) |
-0.00s (- 0.11%) |
0.91s |
0.93s |
| Bind Time |
0.70s (± 1.14%) |
0.71s (± 1.13%) |
+0.01s (+ 0.85%) |
0.69s |
0.73s |
| Check Time |
4.16s (± 0.42%) |
4.14s (± 0.40%) |
-0.02s (- 0.60%) |
4.11s |
4.17s |
| Emit Time |
3.03s (± 0.42%) |
3.06s (± 1.09%) |
+0.03s (+ 0.96%) |
3.00s |
3.16s |
| Total Time |
8.82s (± 0.34%) |
8.83s (± 0.43%) |
+0.01s (+ 0.12%) |
8.79s |
8.96s |
| Angular - node (v8.9.0, x64) |
| Memory used |
328,887k (± 0.01%) |
322,657k (± 0.02%) |
-6,230k (- 1.89%) |
322,512k |
322,858k |
| Parse Time |
2.10s (± 0.39%) |
2.09s (± 0.47%) |
-0.01s (- 0.57%) |
2.07s |
2.12s |
| Bind Time |
0.92s (± 0.83%) |
0.92s (± 1.05%) |
+0.00s (+ 0.55%) |
0.90s |
0.94s |
| Check Time |
5.45s (± 0.46%) |
5.39s (± 0.94%) |
-0.07s (- 1.21%) |
5.22s |
5.46s |
| Emit Time |
6.19s (± 0.42%) |
6.17s (± 0.77%) |
-0.02s (- 0.31%) |
6.06s |
6.27s |
| Total Time |
14.66s (± 0.31%) |
14.57s (± 0.38%) |
-0.09s (- 0.63%) |
14.41s |
14.64s |
| Monaco - node (v8.9.0, x64) |
| Memory used |
333,477k (± 0.01%) |
326,780k (± 0.04%) |
-6,697k (- 2.01%) |
326,558k |
327,087k |
| Parse Time |
1.53s (± 0.26%) |
1.53s (± 0.34%) |
0.00s ( 0.00%) |
1.52s |
1.54s |
| Bind Time |
0.90s (± 1.82%) |
0.89s (± 0.97%) |
-0.01s (- 0.56%) |
0.88s |
0.91s |
| Check Time |
5.33s (± 0.55%) |
5.30s (± 0.51%) |
-0.03s (- 0.53%) |
5.24s |
5.37s |
| Emit Time |
3.53s (± 0.49%) |
3.46s (± 0.36%) |
-0.07s (- 1.98%) |
3.43s |
3.49s |
| Total Time |
11.29s (± 0.23%) |
11.19s (± 0.27%) |
-0.10s (- 0.93%) |
11.11s |
11.26s |
| TFS - node (v8.9.0, x64) |
| Memory used |
298,770k (± 0.02%) |
292,307k (± 0.01%) |
-6,463k (- 2.16%) |
292,256k |
292,390k |
| Parse Time |
1.25s (± 0.36%) |
1.25s (± 0.38%) |
-0.00s (- 0.16%) |
1.24s |
1.26s |
| Bind Time |
0.75s (± 0.66%) |
0.75s (± 0.53%) |
+0.00s (+ 0.67%) |
0.74s |
0.76s |
| Check Time |
4.79s (± 0.50%) |
4.80s (± 0.39%) |
+0.00s (+ 0.06%) |
4.75s |
4.83s |
| Emit Time |
3.37s (± 0.69%) |
3.36s (± 0.64%) |
-0.02s (- 0.47%) |
3.29s |
3.39s |
| Total Time |
10.16s (± 0.36%) |
10.15s (± 0.34%) |
-0.01s (- 0.07%) |
10.04s |
10.21s |
| Angular - node (v8.9.0, x86) |
| Memory used |
188,638k (± 0.02%) |
185,522k (± 0.04%) |
-3,116k (- 1.65%) |
185,411k |
185,688k |
| Parse Time |
2.05s (± 0.70%) |
2.05s (± 0.75%) |
-0.00s (- 0.10%) |
2.02s |
2.09s |
| Bind Time |
1.07s (± 0.52%) |
1.07s (± 0.32%) |
+0.00s (+ 0.09%) |
1.07s |
1.08s |
| Check Time |
5.00s (± 0.41%) |
4.96s (± 0.69%) |
-0.04s (- 0.82%) |
4.90s |
5.06s |
| Emit Time |
6.14s (± 0.61%) |
6.01s (± 0.81%) |
-0.13s (- 2.13%) |
5.90s |
6.17s |
| Total Time |
14.26s (± 0.35%) |
14.09s (± 0.62%) |
-0.17s (- 1.19%) |
13.94s |
14.40s |
| Monaco - node (v8.9.0, x86) |
| Memory used |
189,088k (± 0.02%) |
185,738k (± 0.02%) |
-3,350k (- 1.77%) |
185,645k |
185,802k |
| Parse Time |
1.58s (± 0.89%) |
1.59s (± 0.53%) |
+0.01s (+ 0.70%) |
1.57s |
1.60s |
| Bind Time |
0.77s (± 1.07%) |
0.76s (± 0.89%) |
-0.00s (- 0.39%) |
0.75s |
0.78s |
| Check Time |
5.36s (± 1.38%) |
5.33s (± 1.30%) |
-0.03s (- 0.60%) |
5.08s |
5.45s |
| Emit Time |
2.98s (± 3.37%) |
2.87s (± 2.84%) |
-0.11s (- 3.75%) |
2.80s |
3.19s |
| Total Time |
10.69s (± 0.71%) |
10.55s (± 0.46%) |
-0.14s (- 1.31%) |
10.44s |
10.66s |
| TFS - node (v8.9.0, x86) |
| Memory used |
170,326k (± 0.03%) |
167,086k (± 0.01%) |
-3,240k (- 1.90%) |
167,024k |
167,128k |
| Parse Time |
1.27s (± 0.59%) |
1.28s (± 0.71%) |
+0.01s (+ 0.39%) |
1.25s |
1.30s |
| Bind Time |
0.72s (± 0.83%) |
0.71s (± 0.91%) |
-0.00s (- 0.56%) |
0.70s |
0.72s |
| Check Time |
4.60s (± 0.48%) |
4.58s (± 0.90%) |
-0.02s (- 0.46%) |
4.50s |
4.70s |
| Emit Time |
2.95s (± 0.73%) |
2.99s (± 2.00%) |
+0.04s (+ 1.25%) |
2.93s |
3.21s |
| Total Time |
9.54s (± 0.40%) |
9.56s (± 0.65%) |
+0.02s (+ 0.20%) |
9.46s |
9.72s |
System
| Machine Name | ts-ci-ubuntu |
| Platform | linux 4.4.0-166-generic |
| Architecture | x64 |
| Available Memory | 16 GB |
| Available Memory | 1 GB |
| CPUs | 4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz |
Hosts
- node (v10.16.3, x64)
- node (v12.1.0, x64)
- node (v8.9.0, x64)
- node (v8.9.0, x86)
Scenarios
- Angular - node (v10.16.3, x64)
- Angular - node (v12.1.0, x64)
- Angular - node (v8.9.0, x64)
- Angular - node (v8.9.0, x86)
- Monaco - node (v10.16.3, x64)
- Monaco - node (v12.1.0, x64)
- Monaco - node (v8.9.0, x64)
- Monaco - node (v8.9.0, x86)
- TFS - node (v10.16.3, x64)
- TFS - node (v12.1.0, x64)
- TFS - node (v8.9.0, x64)
- TFS - node (v8.9.0, x86)
| Benchmark |
Name |
Iterations |
| Current |
36845 |
10 |
| Baseline |
master |
10 |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
side question: where is the code/repo for the benchmark suite?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Using a constructor function like this can help node better optimize
object allocation. This improves memory usage when compiling
`src/compiler` from **277M** to **270M**, a nice ~3% win.
sandersn, ExE-Boss, and imteekay reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
In JS, you can annotate ES5‑style constructor functions with /** @constructor */ to tell TypeScript that the function is meant to be called with new.
Though I don’t know how you’d tell TypeScript that it implements an interface.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
|