Skip to content

Indirect calls for imported functions - #44624

Merged
Ron Buckton (rbuckton) merged 2 commits into
mainfrom
indirectlyCallImportedFunctions
Jun 22, 2021
Merged

Indirect calls for imported functions#44624
Ron Buckton (rbuckton) merged 2 commits into
mainfrom
indirectlyCallImportedFunctions

Conversation

@rbuckton

Copy link
Copy Markdown
Contributor

Another attempt to address indirect calls for imported functions.

Fixes#35420

@rbuckton

Copy link
Copy Markdown
ContributorAuthor

TypeScript Bot (@typescript-bot) perf test

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 17, 2021

Copy link
Copy Markdown
Contributor

Heya Ron Buckton (@rbuckton), I've started to run the perf test suite on this PR at f0a7f99. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Ron Buckton (@rbuckton)
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..44624

Metricmain44624DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used344,262k (± 0.02%)344,553k (± 0.03%)+291k (+ 0.08%)344,318k344,769k
Parse Time1.80s (± 0.46%)1.79s (± 0.41%)-0.01s (- 0.45%)1.78s1.81s
Bind Time0.84s (± 0.69%)0.83s (± 0.41%)-0.00s (- 0.48%)0.83s0.84s
Check Time5.21s (± 0.45%)5.21s (± 0.32%)-0.01s (- 0.17%)5.18s5.25s
Emit Time5.49s (± 0.96%)5.62s (± 0.51%)+0.13s (+ 2.33%)5.57s5.71s
Total Time13.34s (± 0.56%)13.45s (± 0.23%)+0.11s (+ 0.82%)13.39s13.52s
Compiler-Unions - node (v10.16.3, x64)
Memory used200,493k (± 0.03%)200,885k (± 0.07%)+393k (+ 0.20%)200,455k201,189k
Parse Time0.78s (± 1.00%)0.78s (± 0.77%)-0.00s (- 0.39%)0.76s0.79s
Bind Time0.53s (± 1.42%)0.52s (± 0.91%)-0.00s (- 0.76%)0.51s0.53s
Check Time7.55s (± 0.56%)7.58s (± 0.75%)+0.02s (+ 0.32%)7.45s7.66s
Emit Time2.24s (± 0.75%)2.29s (± 1.03%)+0.04s (+ 1.96%)2.25s2.36s
Total Time11.10s (± 0.42%)11.16s (± 0.52%)+0.06s (+ 0.55%)11.02s11.26s
Monaco - node (v10.16.3, x64)
Memory used340,543k (± 0.02%)340,813k (± 0.02%)+270k (+ 0.08%)340,679k340,929k
Parse Time1.45s (± 0.68%)1.45s (± 0.45%)-0.00s (- 0.00%)1.44s1.47s
Bind Time0.74s (± 0.63%)0.73s (± 0.46%)-0.01s (- 0.95%)0.73s0.74s
Check Time5.36s (± 0.63%)5.36s (± 0.35%)-0.01s (- 0.17%)5.30s5.39s
Emit Time2.98s (± 1.13%)3.00s (± 0.86%)+0.02s (+ 0.70%)2.96s3.08s
Total Time10.54s (± 0.48%)10.54s (± 0.41%)+0.01s (+ 0.05%)10.44s10.67s
TFS - node (v10.16.3, x64)
Memory used304,171k (± 0.02%)304,357k (± 0.02%)+186k (+ 0.06%)304,212k304,462k
Parse Time1.18s (± 0.42%)1.17s (± 0.62%)-0.00s (- 0.26%)1.16s1.19s
Bind Time0.71s (± 0.73%)0.70s (± 0.68%)-0.01s (- 1.13%)0.69s0.71s
Check Time4.89s (± 0.47%)4.87s (± 0.42%)-0.02s (- 0.41%)4.82s4.91s
Emit Time3.07s (± 1.56%)3.13s (± 1.25%)+0.06s (+ 1.96%)3.06s3.22s
Total Time9.84s (± 0.60%)9.87s (± 0.55%)+0.03s (+ 0.36%)9.79s10.02s
material-ui - node (v10.16.3, x64)
Memory used473,969k (± 0.02%)474,023k (± 0.01%)+53k (+ 0.01%)473,871k474,139k
Parse Time1.73s (± 0.35%)1.72s (± 0.42%)-0.00s (- 0.17%)1.71s1.74s
Bind Time0.66s (± 0.72%)0.66s (± 0.61%)-0.00s (- 0.30%)0.65s0.67s
Check Time15.03s (± 0.51%)14.83s (± 0.55%)-0.20s (- 1.34%)14.62s15.03s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time17.42s (± 0.47%)17.21s (± 0.50%)-0.21s (- 1.19%)16.99s17.43s
Angular - node (v12.1.0, x64)
Memory used322,503k (± 0.03%)322,731k (± 0.02%)+228k (+ 0.07%)322,593k322,825k
Parse Time1.77s (± 0.50%)1.77s (± 0.41%)+0.01s (+ 0.34%)1.76s1.79s
Bind Time0.82s (± 0.83%)0.82s (± 0.83%)0.00s ( 0.00%)0.81s0.84s
Check Time5.12s (± 0.46%)5.10s (± 0.66%)-0.02s (- 0.41%)5.04s5.18s
Emit Time5.68s (± 0.86%)5.85s (± 0.61%)+0.17s (+ 3.07%)5.75s5.93s
Total Time13.39s (± 0.35%)13.55s (± 0.40%)+0.16s (+ 1.20%)13.41s13.65s
Compiler-Unions - node (v12.1.0, x64)
Memory used187,760k (± 0.10%)188,373k (± 0.09%)+613k (+ 0.33%)187,868k188,753k
Parse Time0.77s (± 0.72%)0.77s (± 0.29%)+0.00s (+ 0.13%)0.76s0.77s
Bind Time0.53s (± 0.69%)0.53s (± 0.76%)+0.00s (+ 0.57%)0.52s0.54s
Check Time7.02s (± 0.54%)7.02s (± 0.28%)+0.00s (+ 0.06%)6.99s7.07s
Emit Time2.24s (± 1.03%)2.32s (± 0.55%)+0.08s (+ 3.66%)2.30s2.36s
Total Time10.55s (± 0.36%)10.64s (± 0.27%)+0.09s (+ 0.83%)10.60s10.73s
Monaco - node (v12.1.0, x64)
Memory used323,536k (± 0.02%)323,801k (± 0.03%)+264k (+ 0.08%)323,592k324,074k
Parse Time1.42s (± 0.59%)1.41s (± 0.57%)-0.01s (- 0.78%)1.39s1.42s
Bind Time0.71s (± 1.05%)0.71s (± 0.84%)+0.00s (+ 0.28%)0.70s0.73s
Check Time5.21s (± 0.37%)5.18s (± 0.33%)-0.03s (- 0.58%)5.13s5.20s
Emit Time3.00s (± 0.66%)3.04s (± 0.53%)+0.04s (+ 1.30%)3.01s3.08s
Total Time10.35s (± 0.31%)10.35s (± 0.30%)-0.00s (- 0.00%)10.26s10.40s
TFS - node (v12.1.0, x64)
Memory used288,651k (± 0.03%)288,951k (± 0.03%)+299k (+ 0.10%)288,832k289,217k
Parse Time1.19s (± 0.89%)1.18s (± 0.63%)-0.01s (- 0.51%)1.17s1.20s
Bind Time0.69s (± 1.21%)0.68s (± 1.00%)-0.00s (- 0.29%)0.67s0.70s
Check Time4.78s (± 0.36%)4.78s (± 0.68%)+0.01s (+ 0.13%)4.69s4.86s
Emit Time3.09s (± 0.85%)3.19s (± 0.54%)+0.10s (+ 3.14%)3.15s3.24s
Total Time9.75s (± 0.36%)9.84s (± 0.45%)+0.09s (+ 0.97%)9.70s9.91s
material-ui - node (v12.1.0, x64)
Memory used452,770k (± 0.01%)452,813k (± 0.02%)+43k (+ 0.01%)452,601k452,947k
Parse Time1.71s (± 0.62%)1.71s (± 0.55%)-0.00s (- 0.12%)1.69s1.74s
Bind Time0.64s (± 1.05%)0.65s (± 1.30%)+0.01s (+ 2.20%)0.64s0.68s
Check Time13.43s (± 0.45%)13.33s (± 0.44%)-0.10s (- 0.76%)13.22s13.52s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.79s (± 0.45%)15.69s (± 0.40%)-0.09s (- 0.58%)15.59s15.88s
Angular - node (v14.15.1, x64)
Memory used321,215k (± 0.01%)321,431k (± 0.01%)+217k (+ 0.07%)321,356k321,469k
Parse Time1.79s (± 0.43%)1.80s (± 0.55%)+0.01s (+ 0.50%)1.78s1.82s
Bind Time0.87s (± 1.00%)0.87s (± 0.77%)+0.01s (+ 0.58%)0.86s0.89s
Check Time5.12s (± 0.44%)5.11s (± 0.45%)-0.01s (- 0.25%)5.07s5.17s
Emit Time5.72s (± 0.50%)5.90s (± 0.72%)+0.18s (+ 3.09%)5.80s6.01s
Total Time13.50s (± 0.28%)13.68s (± 0.51%)+0.18s (+ 1.35%)13.57s13.84s
Compiler-Unions - node (v14.15.1, x64)
Memory used188,899k (± 0.57%)189,283k (± 0.56%)+384k (+ 0.20%)187,142k190,413k
Parse Time0.81s (± 0.92%)0.80s (± 0.28%)-0.01s (- 1.36%)0.79s0.80s
Bind Time0.56s (± 0.53%)0.56s (± 0.93%)+0.00s (+ 0.18%)0.55s0.57s
Check Time7.16s (± 0.53%)7.17s (± 1.15%)+0.01s (+ 0.08%)7.04s7.46s
Emit Time2.27s (± 1.14%)2.33s (± 1.21%)+0.06s (+ 2.64%)2.28s2.42s
Total Time10.81s (± 0.47%)10.86s (± 0.96%)+0.05s (+ 0.49%)10.73s11.24s
Monaco - node (v14.15.1, x64)
Memory used322,583k (± 0.01%)322,690k (± 0.01%)+108k (+ 0.03%)322,649k322,736k
Parse Time1.47s (± 0.53%)1.47s (± 0.48%)+0.00s (+ 0.14%)1.46s1.49s
Bind Time0.74s (± 1.10%)0.74s (± 0.91%)+0.00s (+ 0.13%)0.73s0.76s
Check Time5.18s (± 0.53%)5.17s (± 0.39%)-0.02s (- 0.37%)5.13s5.22s
Emit Time3.07s (± 0.52%)3.10s (± 0.71%)+0.03s (+ 1.01%)3.05s3.14s
Total Time10.47s (± 0.29%)10.49s (± 0.25%)+0.02s (+ 0.17%)10.43s10.55s
TFS - node (v14.15.1, x64)
Memory used287,688k (± 0.01%)287,905k (± 0.01%)+217k (+ 0.08%)287,859k287,931k
Parse Time1.26s (± 1.74%)1.27s (± 2.30%)+0.02s (+ 1.35%)1.22s1.35s
Bind Time0.71s (± 0.63%)0.71s (± 0.91%)0.00s ( 0.00%)0.70s0.73s
Check Time4.80s (± 0.31%)4.82s (± 0.44%)+0.01s (+ 0.23%)4.77s4.86s
Emit Time3.21s (± 0.73%)3.28s (± 0.69%)+0.08s (+ 2.40%)3.22s3.33s
Total Time9.98s (± 0.27%)10.09s (± 0.40%)+0.11s (+ 1.07%)9.99s10.19s
material-ui - node (v14.15.1, x64)
Memory used451,067k (± 0.01%)450,984k (± 0.00%)-83k (- 0.02%)450,957k451,021k
Parse Time1.74s (± 0.60%)1.74s (± 0.39%)+0.00s (+ 0.06%)1.73s1.76s
Bind Time0.69s (± 0.65%)0.69s (± 0.48%)+0.00s (+ 0.29%)0.68s0.70s
Check Time13.61s (± 0.50%)13.52s (± 0.66%)-0.09s (- 0.64%)13.40s13.77s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.04s (± 0.43%)15.95s (± 0.56%)-0.09s (- 0.54%)15.84s16.21s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory1 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)
BenchmarkNameIterations
Current4462410
Baselinemain10

Developer Information:

Download Benchmark

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Other stuff looks fine but let's not include package-lock.json as part of this (if we want to do that at all)

@rbuckton

Copy link
Copy Markdown
ContributorAuthor

package-lock existing is surprising. I thought we had an .npmrc that disabled package-lock.

@rbuckton
Ron Buckton (rbuckton)force-pushed the indirectlyCallImportedFunctions branch 2 times, most recently from f9f719a to 143e4a1CompareJune 18, 2021 23:23
@rbuckton
Ron Buckton (rbuckton)force-pushed the indirectlyCallImportedFunctions branch from 143e4a1 to 4e056d3CompareJune 18, 2021 23:33
@rbuckton

Ron Buckton (rbuckton) commented Jun 18, 2021

Copy link
Copy Markdown
ContributorAuthor

I guess we started generating a package-lock.json at some point, but it's still in our .gitignore. I've restored the version from main.

@rbuckton

Ron Buckton (rbuckton) commented Jun 19, 2021

Copy link
Copy Markdown
ContributorAuthor

package-lock.json has been reverted. Ryan Cavanaugh (@RyanCavanaugh): any other concerns or should I merge?

Kristiyan Kostadinov (crisbeto) added a commit to crisbeto/angular that referenced this pull request Sep 22, 2021
Adds support for TypeScript 4.4. High-level overview of the changes made in this PR:
* Bumps the various packages to `typescript@4.4.2` and `tslib@2.3.0`.
* The `useUnknownInCatchVariables` compiler option has been disabled so that we don't have to cast error objects explicitly everywhere.
* TS now passes in a third argument to the `__spreadArray` call inside child class constructors. I had to update a couple of places in the runtime and ngcc to be able to pick up the calls correctly.
* TS now generates code like `(0, foo)(arg1, arg2)` for imported function calls. I had to update a few of our tests to account for it. See microsoft/TypeScript#44624.
* Our `ngtsc` test setup calls the private `matchFiles` function from TS. I had to update our usage, because a new parameter was added.
* There was one place where we were setting the readonly `hasTrailingComma` property. I updated the usage to pass in the value when constructing the object instead.
* Some browser types were updated which meant that I had to resolve some trivial type errors.
* The downlevel decorators tranform was running into an issue where the Closure synthetic comments were being emitted twice. I've worked around it by recreating the class declaration node instead of cloning it.
Alex Rickabaugh (alxhub) pushed a commit to angular/angular that referenced this pull request Sep 23, 2021
Adds support for TypeScript 4.4. High-level overview of the changes made in this PR:
* Bumps the various packages to `typescript@4.4.2` and `tslib@2.3.0`.
* The `useUnknownInCatchVariables` compiler option has been disabled so that we don't have to cast error objects explicitly everywhere.
* TS now passes in a third argument to the `__spreadArray` call inside child class constructors. I had to update a couple of places in the runtime and ngcc to be able to pick up the calls correctly.
* TS now generates code like `(0, foo)(arg1, arg2)` for imported function calls. I had to update a few of our tests to account for it. See microsoft/TypeScript#44624.
* Our `ngtsc` test setup calls the private `matchFiles` function from TS. I had to update our usage, because a new parameter was added.
* There was one place where we were setting the readonly `hasTrailingComma` property. I updated the usage to pass in the value when constructing the object instead.
* Some browser types were updated which meant that I had to resolve some trivial type errors.
* The downlevel decorators tranform was running into an issue where the Closure synthetic comments were being emitted twice. I've worked around it by recreating the class declaration node instead of cloning it.
PR Close#43281
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functions wrapped in __importDefault with allowSyntheticDefaultImports emit incorrect function calls

3 participants

@rbuckton@typescript-bot@RyanCavanaugh