Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure parameters are in scope when converting parameter/return types to type nodes #49627

Merged
merged 4 commits into from
Feb 18, 2023

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Jun 22, 2022

Fixes #48783

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jun 22, 2022
@jakebailey jakebailey marked this pull request as draft June 22, 2022 03:46
@jakebailey
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this inline
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Heya @jakebailey, I've started to run the perf test suite on this PR at 70dba24. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 70dba24. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 70dba24. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Heya @jakebailey, I've started to run the extended test suite on this PR at 70dba24. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here.

@typescript-bot
Copy link
Collaborator

@jakebailey
Great news! no new errors were found between main..refs/pull/49627/merge

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..49627

Metric main 49627 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 359,540k (± 0.02%) 359,610k (± 0.02%) +70k (+ 0.02%) 359,432k 359,750k
Parse Time 2.11s (± 0.61%) 2.11s (± 0.56%) -0.01s (- 0.33%) 2.08s 2.13s
Bind Time 0.90s (± 0.72%) 0.90s (± 0.64%) -0.00s (- 0.22%) 0.89s 0.91s
Check Time 5.95s (± 0.44%) 6.00s (± 0.74%) +0.04s (+ 0.72%) 5.91s 6.09s
Emit Time 6.13s (± 0.59%) 6.10s (± 0.93%) -0.03s (- 0.49%) 5.99s 6.24s
Total Time 15.10s (± 0.33%) 15.10s (± 0.65%) +0.00s (+ 0.01%) 14.89s 15.32s
Compiler-Unions - node (v10.16.3, x64)
Memory used 206,478k (± 0.04%) 206,407k (± 0.04%) -71k (- 0.03%) 206,217k 206,585k
Parse Time 0.84s (± 0.70%) 0.85s (± 0.53%) +0.00s (+ 0.47%) 0.84s 0.86s
Bind Time 0.53s (± 1.51%) 0.53s (± 1.38%) +0.00s (+ 0.00%) 0.51s 0.55s
Check Time 8.12s (± 0.59%) 8.09s (± 0.64%) -0.03s (- 0.38%) 7.95s 8.19s
Emit Time 2.50s (± 0.64%) 2.52s (± 1.06%) +0.02s (+ 0.92%) 2.45s 2.57s
Total Time 11.99s (± 0.51%) 11.98s (± 0.58%) -0.01s (- 0.05%) 11.81s 12.08s
Monaco - node (v10.16.3, x64)
Memory used 343,932k (± 0.01%) 343,925k (± 0.01%) -7k (- 0.00%) 343,837k 344,056k
Parse Time 1.60s (± 0.39%) 1.60s (± 0.55%) +0.00s (+ 0.06%) 1.58s 1.62s
Bind Time 0.77s (± 0.64%) 0.78s (± 1.56%) +0.01s (+ 0.90%) 0.76s 0.81s
Check Time 5.96s (± 0.39%) 5.94s (± 0.69%) -0.02s (- 0.34%) 5.85s 6.04s
Emit Time 3.26s (± 0.85%) 3.25s (± 0.69%) -0.00s (- 0.12%) 3.20s 3.29s
Total Time 11.59s (± 0.42%) 11.57s (± 0.44%) -0.02s (- 0.14%) 11.50s 11.70s
TFS - node (v10.16.3, x64)
Memory used 305,066k (± 0.02%) 305,121k (± 0.02%) +55k (+ 0.02%) 305,014k 305,309k
Parse Time 1.29s (± 0.58%) 1.28s (± 0.69%) -0.00s (- 0.23%) 1.27s 1.31s
Bind Time 0.73s (± 0.71%) 0.72s (± 0.80%) -0.01s (- 0.82%) 0.71s 0.73s
Check Time 5.41s (± 0.53%) 5.40s (± 0.63%) -0.02s (- 0.30%) 5.33s 5.47s
Emit Time 3.43s (± 1.39%) 3.42s (± 1.05%) -0.02s (- 0.50%) 3.36s 3.54s
Total Time 10.86s (± 0.68%) 10.82s (± 0.52%) -0.04s (- 0.41%) 10.70s 10.94s
material-ui - node (v10.16.3, x64)
Memory used 469,051k (± 0.01%) 469,049k (± 0.01%) -2k (- 0.00%) 468,972k 469,115k
Parse Time 1.85s (± 0.53%) 1.85s (± 0.48%) -0.00s (- 0.16%) 1.83s 1.86s
Bind Time 0.70s (± 1.26%) 0.70s (± 1.11%) -0.00s (- 0.14%) 0.68s 0.72s
Check Time 14.55s (± 0.51%) 14.56s (± 0.75%) +0.01s (+ 0.08%) 14.34s 14.93s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 17.09s (± 0.49%) 17.10s (± 0.67%) +0.01s (+ 0.05%) 16.89s 17.50s
xstate - node (v10.16.3, x64)
Memory used 584,361k (± 1.66%) 581,002k (± 1.26%) -3,360k (- 0.57%) 577,535k 610,524k
Parse Time 2.63s (± 0.21%) 2.61s (± 0.34%) -0.01s (- 0.57%) 2.59s 2.63s
Bind Time 1.04s (± 0.35%) 1.03s (± 0.68%) -0.01s (- 1.44%) 1.01s 1.04s
Check Time 1.54s (± 0.54%) 1.54s (± 0.94%) -0.00s (- 0.06%) 1.52s 1.58s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 5.28s (± 0.19%) 5.26s (± 0.20%) -0.03s (- 0.47%) 5.23s 5.28s
Angular - node (v12.1.0, x64)
Memory used 337,149k (± 0.02%) 337,041k (± 0.09%) -108k (- 0.03%) 335,790k 337,322k
Parse Time 2.10s (± 0.54%) 2.09s (± 0.71%) -0.01s (- 0.33%) 2.06s 2.12s
Bind Time 0.86s (± 0.52%) 0.86s (± 0.55%) +0.00s (+ 0.23%) 0.85s 0.87s
Check Time 5.80s (± 0.36%) 5.79s (± 0.54%) -0.01s (- 0.14%) 5.73s 5.88s
Emit Time 6.35s (± 0.47%) 6.36s (± 0.82%) +0.01s (+ 0.17%) 6.25s 6.47s
Total Time 15.11s (± 0.36%) 15.11s (± 0.54%) -0.00s (- 0.02%) 14.92s 15.29s
Compiler-Unions - node (v12.1.0, x64)
Memory used 193,935k (± 0.11%) 193,887k (± 0.15%) -48k (- 0.02%) 193,098k 194,399k
Parse Time 0.85s (± 1.09%) 0.84s (± 0.68%) -0.01s (- 0.94%) 0.83s 0.85s
Bind Time 0.55s (± 1.22%) 0.54s (± 1.37%) -0.00s (- 0.73%) 0.53s 0.57s
Check Time 7.58s (± 0.49%) 7.54s (± 0.73%) -0.05s (- 0.61%) 7.42s 7.66s
Emit Time 2.53s (± 0.90%) 2.54s (± 1.16%) +0.01s (+ 0.55%) 2.47s 2.61s
Total Time 11.50s (± 0.44%) 11.46s (± 0.53%) -0.04s (- 0.33%) 11.33s 11.65s
Monaco - node (v12.1.0, x64)
Memory used 326,846k (± 0.02%) 326,870k (± 0.02%) +25k (+ 0.01%) 326,767k 327,074k
Parse Time 1.58s (± 1.03%) 1.57s (± 0.80%) -0.01s (- 0.95%) 1.54s 1.59s
Bind Time 0.76s (± 0.63%) 0.76s (± 0.63%) +0.00s (+ 0.00%) 0.75s 0.77s
Check Time 5.80s (± 0.58%) 5.77s (± 0.50%) -0.03s (- 0.50%) 5.72s 5.83s
Emit Time 3.31s (± 0.93%) 3.30s (± 0.84%) -0.01s (- 0.24%) 3.25s 3.36s
Total Time 11.45s (± 0.42%) 11.40s (± 0.44%) -0.05s (- 0.45%) 11.31s 11.51s
TFS - node (v12.1.0, x64)
Memory used 289,723k (± 0.02%) 289,712k (± 0.02%) -10k (- 0.00%) 289,624k 289,876k
Parse Time 1.32s (± 0.83%) 1.31s (± 1.04%) -0.01s (- 1.13%) 1.28s 1.34s
Bind Time 0.72s (± 0.80%) 0.73s (± 1.52%) +0.00s (+ 0.55%) 0.71s 0.76s
Check Time 5.34s (± 0.50%) 5.31s (± 0.38%) -0.03s (- 0.58%) 5.27s 5.36s
Emit Time 3.54s (± 0.86%) 3.54s (± 1.65%) +0.01s (+ 0.14%) 3.43s 3.65s
Total Time 10.93s (± 0.45%) 10.89s (± 0.62%) -0.04s (- 0.38%) 10.76s 11.06s
material-ui - node (v12.1.0, x64)
Memory used 448,154k (± 0.01%) 448,053k (± 0.06%) -101k (- 0.02%) 447,093k 448,277k
Parse Time 1.84s (± 0.63%) 1.85s (± 0.45%) +0.00s (+ 0.05%) 1.83s 1.86s
Bind Time 0.68s (± 0.65%) 0.68s (± 0.49%) -0.00s (- 0.29%) 0.67s 0.69s
Check Time 13.02s (± 0.52%) 13.05s (± 0.44%) +0.03s (+ 0.23%) 12.90s 13.17s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.55s (± 0.48%) 15.57s (± 0.37%) +0.03s (+ 0.19%) 15.44s 15.69s
xstate - node (v12.1.0, x64)
Memory used 546,454k (± 1.31%) 546,544k (± 1.31%) +89k (+ 0.02%) 543,207k 575,562k
Parse Time 2.58s (± 0.55%) 2.57s (± 0.59%) -0.01s (- 0.39%) 2.54s 2.61s
Bind Time 1.06s (± 1.08%) 1.05s (± 1.50%) -0.01s (- 0.85%) 1.01s 1.09s
Check Time 1.49s (± 0.73%) 1.48s (± 0.52%) -0.01s (- 0.47%) 1.46s 1.49s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 5.20s (± 0.32%) 5.18s (± 0.42%) -0.03s (- 0.50%) 5.13s 5.24s
Angular - node (v14.15.1, x64)
Memory used 335,317k (± 0.01%) 335,342k (± 0.01%) +24k (+ 0.01%) 335,296k 335,389k
Parse Time 2.09s (± 0.68%) 2.08s (± 0.69%) -0.01s (- 0.53%) 2.06s 2.12s
Bind Time 0.91s (± 0.52%) 0.91s (± 0.82%) 0.00s ( 0.00%) 0.89s 0.93s
Check Time 5.75s (± 0.40%) 5.76s (± 0.44%) +0.01s (+ 0.21%) 5.72s 5.81s
Emit Time 6.42s (± 0.72%) 6.41s (± 0.75%) -0.01s (- 0.19%) 6.34s 6.54s
Total Time 15.17s (± 0.36%) 15.15s (± 0.55%) -0.01s (- 0.08%) 15.01s 15.38s
Compiler-Unions - node (v14.15.1, x64)
Memory used 192,554k (± 0.13%) 192,995k (± 0.38%) +442k (+ 0.23%) 192,626k 195,955k
Parse Time 0.86s (± 0.69%) 0.85s (± 0.78%) -0.00s (- 0.35%) 0.84s 0.87s
Bind Time 0.58s (± 1.29%) 0.57s (± 0.39%) -0.01s (- 1.04%) 0.57s 0.58s
Check Time 7.73s (± 0.61%) 7.65s (± 0.78%) -0.08s (- 1.05%) 7.53s 7.76s
Emit Time 2.52s (± 0.55%) 2.53s (± 1.09%) +0.01s (+ 0.56%) 2.47s 2.59s
Total Time 11.68s (± 0.47%) 11.60s (± 0.71%) -0.08s (- 0.66%) 11.42s 11.78s
Monaco - node (v14.15.1, x64)
Memory used 325,607k (± 0.00%) 325,609k (± 0.01%) +2k (+ 0.00%) 325,576k 325,649k
Parse Time 1.59s (± 0.78%) 1.58s (± 0.57%) -0.01s (- 0.57%) 1.56s 1.60s
Bind Time 0.80s (± 0.60%) 0.79s (± 0.75%) -0.00s (- 0.38%) 0.78s 0.81s
Check Time 5.72s (± 0.69%) 5.70s (± 0.35%) -0.01s (- 0.23%) 5.65s 5.75s
Emit Time 3.37s (± 0.73%) 3.37s (± 0.64%) +0.01s (+ 0.18%) 3.34s 3.43s
Total Time 11.46s (± 0.52%) 11.44s (± 0.29%) -0.02s (- 0.17%) 11.35s 11.54s
TFS - node (v14.15.1, x64)
Memory used 288,754k (± 0.01%) 288,752k (± 0.01%) -2k (- 0.00%) 288,693k 288,829k
Parse Time 1.34s (± 1.52%) 1.32s (± 0.61%) -0.02s (- 1.79%) 1.30s 1.34s
Bind Time 0.75s (± 0.94%) 0.75s (± 0.53%) 0.00s ( 0.00%) 0.74s 0.76s
Check Time 5.33s (± 0.38%) 5.32s (± 0.64%) -0.01s (- 0.19%) 5.24s 5.42s
Emit Time 3.59s (± 2.15%) 3.54s (± 2.17%) -0.05s (- 1.36%) 3.42s 3.72s
Total Time 11.02s (± 0.93%) 10.93s (± 0.98%) -0.08s (- 0.76%) 10.76s 11.21s
material-ui - node (v14.15.1, x64)
Memory used 446,332k (± 0.00%) 446,225k (± 0.05%) -108k (- 0.02%) 445,273k 446,378k
Parse Time 1.89s (± 0.50%) 1.89s (± 0.62%) -0.01s (- 0.37%) 1.86s 1.91s
Bind Time 0.72s (± 1.23%) 0.72s (± 0.92%) -0.00s (- 0.55%) 0.71s 0.73s
Check Time 13.17s (± 0.59%) 13.23s (± 0.81%) +0.05s (+ 0.40%) 13.04s 13.50s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.79s (± 0.49%) 15.84s (± 0.68%) +0.05s (+ 0.31%) 15.65s 16.14s
xstate - node (v14.15.1, x64)
Memory used 541,028k (± 0.00%) 541,036k (± 0.00%) +8k (+ 0.00%) 540,961k 541,072k
Parse Time 2.63s (± 0.49%) 2.63s (± 0.64%) -0.00s (- 0.00%) 2.61s 2.68s
Bind Time 1.17s (± 0.81%) 1.16s (± 0.91%) -0.01s (- 0.60%) 1.14s 1.18s
Check Time 1.53s (± 0.52%) 1.54s (± 0.54%) +0.00s (+ 0.26%) 1.52s 1.56s
Emit Time 0.07s (± 4.92%) 0.07s (± 4.66%) -0.00s (- 1.35%) 0.07s 0.08s
Total Time 5.41s (± 0.30%) 5.40s (± 0.51%) -0.01s (- 0.17%) 5.36s 5.49s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v10.16.3, x64)
  • xstate - node (v12.1.0, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 49627 10
Baseline main 10

Developer Information:

Download Benchmark

@jakebailey jakebailey marked this pull request as ready for review June 22, 2022 18:38
@jakebailey jakebailey requested review from sandersn and weswigham June 22, 2022 18:38
@jakebailey
Copy link
Member Author

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Heya @jakebailey, I've started to run the tarball bundle task on this PR at 6714b2b. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 22, 2022

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/128615/artifacts?artifactName=tgz&fileId=60C8B4A5ED06713FB6C66B5745EA2EB6737C9B19A5285140AFCDFBFCEAB33D7102&fileName=/typescript-4.8.0-insiders.20220622.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@sandersn
Copy link
Member

I haven't reviewed the code yet, but I am weirded out by the whitespace changes -- which are admittedly the same as in #37444. But why insert 3 more spaces in, say, left and right below? It doesn't correspond to initial 4-space indent -- top is indented 8 spaces -- and left and right are only preceded by one space in the source.

module A {

    class Point {
        constructor(public x: number, public y: number) { }
    }

    export var UnitSquare : {
        top: { left: Point, right: Point },
        bottom: { left: Point, right: Point }
    } = null;
}

@jakebailey
Copy link
Member Author

I think before it was creating an all new type node and in doing so put the code onto one line. But after, it's reusing the node, and so it has the spacing as the original source. The baselines just remove the newlines so it looks awkwardly spaced.

I'd test on the above pack-this, but it looks like typescript-staging is down :(

@jakebailey jakebailey marked this pull request as draft July 19, 2022 22:14
@@ -32,6 +32,4 @@ declare global {
}
}
//// [c.d.ts]
declare type Foo = teams.calling.Foo;
export declare const bar: (p?: Foo) => void;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a case that I'm pretty sure only worked because of a fluke. It's desirable, but when we get the type from the annotation, we get the interface type Foo in another file (the symbol is correctly resolved), but then this gets handed down and the info about it being an alias is completely lost. I think this only worked due to assumptions about the enclosing declaration that now no longer hold.

@jakebailey
Copy link
Member Author

I've gotten this PR pretty far but I'm going to stop working on it for a while because it's getting too frustrating. It seems like this part of the code is really fragile when it comes to what it considers to be reusable in ways that I can't seem to keep in my head at once. If fix one thing and break something I fixed earlier, because I forgot what I did and ended up undoing it, etc.

The whole enclosing declaration thing in general weirds me out; it doesn't seem consistent at all which enclosing declaration is used in what scenario, and yet the types baseline code just always uses the parent node, which would lead me to believe that it doesn't need to even exist at all, either, but I'm sure I'm missing something.

@jakebailey jakebailey marked this pull request as ready for review February 16, 2023 20:00
@jakebailey
Copy link
Member Author

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Heya @jakebailey, I've started to run the extended test suite on this PR at c215aa8. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at c215aa8. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at c215aa8. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at c215aa8. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at c215aa8. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/146654/artifacts?artifactName=tgz&fileId=C55F8F23AFED2FCC7B8CA8743191E9878D1B6CB3EE1F76089175519B4C81E4BA02&fileName=/typescript-5.0.0-insiders.20230216.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/49627/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here.

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/49627/merge:

Everything looks good!

@jakebailey
Copy link
Member Author

Forgive the force push; this had so many commits that I wanted to still be able to see the test diffs.

I've updated the logic to share the same node within the same chain instead of repeating it multiple times; I think it's about as fast as it can get.

I also dropped the added property on the context; it turns out that wasn't safe because it's technically possible that another part of the code temporarily changes the enclosing declaration, but we could then accidentally inject new variables into a different chain. Now, we just walk up the ancestors to find an existing one, creating one if needed.

@@ -168,125 +168,3 @@ export declare class AsClassProperty {
isNaN?: typeof globalThis.isNaN;
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;


//// [DtsFileErrors]
Copy link
Member Author

Choose a reason for hiding this comment

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

Note the the errors going away here; I constructed these tests such that they will emit a d.ts error when they're wrong, rather than us having to figure out if the output looks right or not.

@jakebailey
Copy link
Member Author

@typescript-bot perf test faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 18, 2023

Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 27c0c92. You can monitor the build here.

Update: The results are in!

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

I don't think I understand the overall flow of creating a signature declaration enough to properly sign off, but I did have a couple of questions after reading the code.

&& signature.declaration
&& signature.declaration !== context.enclosingDeclaration
&& !isInJSFile(signature.declaration)
&& some(expandedParams)
Copy link
Member

Choose a reason for hiding this comment

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

getExpandedParameters looks like it always returns an array of length 1, at least unless the rest type is somehow a 0-constituent union, but I think those are always impossible.

If the check is there just because the types could allow an empty array, maybe it should be an assert in the body of the if instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Check above, and you'll see:

const expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];

Copy link
Member Author

@jakebailey jakebailey Feb 18, 2023

Choose a reason for hiding this comment

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

(Later I might see if we can avoid constructing a bunch of random arrays we don't need...)

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..49627

Metric main 49627 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 359,093k (± 0.01%) 359,112k (± 0.01%) ~ 359,063k 359,132k p=0.173 n=6
Parse Time 4.16s (± 0.42%) 4.15s (± 0.45%) ~ 4.12s 4.17s p=0.145 n=6
Bind Time 1.24s (± 0.33%) 1.24s (± 0.44%) ~ 1.23s 1.24s p=0.054 n=6
Check Time 9.52s (± 0.44%) 9.50s (± 0.37%) ~ 9.46s 9.55s p=0.373 n=6
Emit Time 8.10s (± 0.68%) 8.10s (± 0.73%) ~ 8.01s 8.18s p=1.000 n=6
Total Time 23.02s (± 0.40%) 22.98s (± 0.33%) ~ 22.89s 23.08s p=0.575 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 191,731k (± 0.02%) 191,770k (± 0.03%) ~ 191,706k 191,840k p=0.298 n=6
Parse Time 1.81s (± 0.97%) 1.81s (± 0.68%) ~ 1.78s 1.81s p=1.000 n=6
Bind Time 0.84s (± 0.48%) 0.84s (± 0.00%) ~ 0.84s 0.84s p=0.405 n=6
Check Time 10.13s (± 0.70%) 10.15s (± 0.47%) ~ 10.06s 10.20s p=0.629 n=6
Emit Time 3.04s (± 0.70%) 3.03s (± 0.65%) ~ 3.01s 3.05s p=0.287 n=6
Total Time 15.82s (± 0.62%) 15.82s (± 0.21%) ~ 15.77s 15.86s p=0.520 n=6
Monaco - node (v16.17.1, x64)
Memory used 343,537k (± 0.01%) 343,559k (± 0.01%) ~ 343,544k 343,591k p=0.173 n=6
Parse Time 3.10s (± 0.53%) 3.14s (± 0.45%) +0.04s (+ 1.40%) 3.12s 3.16s p=0.006 n=6
Bind Time 1.11s (± 0.73%) 1.12s (± 0.92%) ~ 1.10s 1.13s p=0.546 n=6
Check Time 7.79s (± 0.70%) 7.78s (± 0.40%) ~ 7.74s 7.83s p=0.687 n=6
Emit Time 4.51s (± 0.33%) 4.52s (± 0.62%) ~ 4.50s 4.56s p=0.506 n=6
Total Time 16.51s (± 0.37%) 16.56s (± 0.22%) ~ 16.51s 16.62s p=0.170 n=6
TFS - node (v16.17.1, x64)
Memory used 299,646k (± 0.00%) 299,649k (± 0.01%) ~ 299,614k 299,676k p=0.629 n=6
Parse Time 2.45s (± 1.08%) 2.45s (± 0.95%) ~ 2.42s 2.48s p=1.000 n=6
Bind Time 1.26s (± 0.65%) 1.25s (± 0.83%) ~ 1.24s 1.27s p=0.865 n=6
Check Time 7.23s (± 0.43%) 7.21s (± 0.36%) ~ 7.18s 7.24s p=0.197 n=6
Emit Time 4.21s (± 0.47%) 4.24s (± 0.80%) ~ 4.19s 4.29s p=0.120 n=6
Total Time 15.14s (± 0.29%) 15.15s (± 0.39%) ~ 15.06s 15.23s p=0.873 n=6
material-ui - node (v16.17.1, x64)
Memory used 475,972k (± 0.00%) 475,989k (± 0.00%) ~ 475,969k 476,006k p=0.173 n=6
Parse Time 3.68s (± 0.24%) 3.68s (± 0.20%) ~ 3.67s 3.69s p=0.798 n=6
Bind Time 1.02s (± 0.62%) 1.02s (± 0.40%) ~ 1.02s 1.03s p=0.673 n=6
Check Time 18.31s (± 1.24%) 18.28s (± 0.99%) ~ 18.16s 18.64s p=0.747 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 23.01s (± 0.97%) 22.98s (± 0.81%) ~ 22.85s 23.35s p=0.936 n=6
xstate - node (v16.17.1, x64)
Memory used 546,950k (± 0.02%) 546,961k (± 0.03%) ~ 546,697k 547,177k p=0.810 n=6
Parse Time 4.77s (± 0.54%) 4.78s (± 0.45%) ~ 4.75s 4.80s p=0.684 n=6
Bind Time 1.85s (± 0.22%) 1.85s (± 0.44%) ~ 1.84s 1.86s p=0.206 n=6
Check Time 3.07s (± 0.78%) 3.08s (± 0.48%) ~ 3.06s 3.10s p=0.560 n=6
Emit Time 0.09s (± 4.45%) 0.09s (± 4.45%) ~ 0.09s 0.10s p=1.000 n=6
Total Time 9.78s (± 0.45%) 9.80s (± 0.30%) ~ 9.75s 9.83s p=0.748 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
Benchmark Name Iterations
Current 49627 6
Baseline main 6

Developer Information:

Download Benchmark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

globalThis sometimes being stripped from type emition can leads to errors in emited definition
4 participants