Skip to content

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Jul 19, 2022

Fixes #49937

During relation checking, we end up with a source type of TableClass<any> & T. Because it's an intersection, we try relating the result of getEffectiveConstraintOfIntersection(source) against target to see if that succeeds.

getEffectiveConstraintOfIntersection produces an intersection of types and their contraints (the source type in this example is one such intersection). However, #49119 changed getConstraintOfType such that getConstraintOfType(T) is Table, not TableClass<any>, which I believe is correct.

But the caller of getEffectiveConstraintOfIntersection checks if the result contains the source type by exact equality. Since the source by this point has been normalized, equality will fail as the constraint is not yet normalized (which in this case would replace Table with TableClass<any>.

So, make sure that constraint is normalized.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 19, 2022
@jakebailey

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@jakebailey jakebailey changed the title Use isTypeIdenticalTo to check if the source is in the effective constraint of its intersection Normalize effective constraint intersection before checking if source is a part of it Jul 20, 2022
@jakebailey
Copy link
Member Author

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

@typescript-bot

This comment was marked as outdated.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 20, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 20, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 20, 2022

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

Update: The results are in!

@typescript-bot

This comment was marked as outdated.

@typescript-bot
Copy link
Collaborator

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

@typescript-bot

This comment was marked as outdated.

@jakebailey
Copy link
Member Author

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 20, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..49956

Metric main 49956 Delta Best Worst
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 (v14.15.1, x64)
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 49956 10
Baseline main 10

Developer Information:

Download Benchmark

@@ -12118,7 +12118,7 @@ namespace ts {
}
}
}
return getIntersectionType(constraints);
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false); // The source types were normalized; ensure the result is normalized too.
Copy link
Member

Choose a reason for hiding this comment

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

the writing parameter has me a little suspicious here.

Side note, the comment makes this line a bit too long.

Suggested change
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false); // The source types were normalized; ensure the result is normalized too.
// The source types were normalized; ensure the result is normalized too.
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);

Copy link
Member Author

@jakebailey jakebailey Jul 21, 2022

Choose a reason for hiding this comment

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

This function is only called in one place on the source types during relation checking; this mirrors how the same function calls getNormalizedType on the source itself earlier. I had the following code instead at the one call site:

// earlier...
const source = getNormalizedType(originalSource, /*writing*/ false);

// later...
let constraint = getEffectiveConstraintOfIntersection(source.flags & TypeFlags.Intersection ? (source as IntersectionType).types: [source], !!(target.flags & TypeFlags.Union));
if (constraint) {
    constraint = getNormalizedType(constraint, /*writing*/ false);
}
if (constraint && everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
    // ...
}

But opted to stick it into getEffectiveConstraintOfIntersection directly because there is only one call site because it was less complicated. I'm happy to do it more explicitly, of course.

(I think I was worried that someone would add a new call to this function and also forget to normalize it if needed, but maybe that's just not a concern, or nobody will ever add a new call?)

Copy link
Member Author

Choose a reason for hiding this comment

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

The other option is maybe to move all of those argument expressions into getEffectiveConstraintOfIntersection like

function getEffectiveConstraintOfIntersection(source: Type, target: Type) {
    const types = source.flags & TypeFlags.Intersection ? (source as IntersectionType).types: [source];
    const targetIsUnion = !!(target.flags & TypeFlags.Union);
    // ...
}

And then move it into the relation closure to make it obvious that this should only be used in this one place and not for another purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW the above is sort of what I'd prefer (accept source and target). Better yet, move getEffectiveConstraintOfIntersection down into relation to make it obvious what you are/aren't supposed to use it for, but the diff won't be followable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've moved the comment per Daniel's comment.

@DanielRosenwasser
Copy link
Member

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

@jakebailey
Copy link
Member Author

The bot's been acting up recently and doesn't seem to respond half the time.

Most of those are run above, if you want to see the results.

I'm happy to shift the code around if you want, of course.

@jakebailey
Copy link
Member Author

Oh, no, the perf test absolutely did not run earlier, right.

@jakebailey
Copy link
Member Author

@typescript-bot pack this
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 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/130408/artifacts?artifactName=tgz&fileId=07B1D53BE7623CE2DD201C9DBFB292975BCBB56225872499D167B3C61C1D230702&fileName=/typescript-4.8.0-insiders.20220725.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/pr-build@4.8.0-pr-49956-24".;

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..49956
Metric main 49956 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 360,196k (± 0.03%) 360,209k (± 0.03%) +12k (+ 0.00%) 360,049k 360,459k
Parse Time 2.09s (± 0.36%) 2.09s (± 0.51%) -0.01s (- 0.43%) 2.06s 2.11s
Bind Time 0.90s (± 1.00%) 0.89s (± 0.58%) -0.00s (- 0.45%) 0.88s 0.90s
Check Time 6.00s (± 0.44%) 5.99s (± 0.63%) -0.01s (- 0.15%) 5.91s 6.10s
Emit Time 6.13s (± 0.61%) 6.14s (± 0.73%) +0.00s (+ 0.03%) 6.05s 6.22s
Total Time 15.13s (± 0.43%) 15.11s (± 0.52%) -0.02s (- 0.15%) 14.99s 15.30s
Compiler-Unions - node (v10.16.3, x64)
Memory used 206,864k (± 0.03%) 206,919k (± 0.02%) +55k (+ 0.03%) 206,790k 207,022k
Parse Time 0.83s (± 1.13%) 0.83s (± 0.89%) -0.00s (- 0.00%) 0.81s 0.85s
Bind Time 0.53s (± 1.46%) 0.52s (± 1.43%) -0.01s (- 1.51%) 0.51s 0.54s
Check Time 7.12s (± 0.33%) 7.13s (± 0.45%) +0.01s (+ 0.17%) 7.04s 7.19s
Emit Time 2.53s (± 1.02%) 2.51s (± 0.83%) -0.02s (- 0.75%) 2.47s 2.55s
Total Time 11.01s (± 0.42%) 10.99s (± 0.37%) -0.02s (- 0.15%) 10.90s 11.09s
Monaco - node (v10.16.3, x64)
Memory used 343,870k (± 0.02%) 343,855k (± 0.02%) -14k (- 0.00%) 343,651k 344,024k
Parse Time 1.60s (± 0.72%) 1.60s (± 0.62%) 0.00s ( 0.00%) 1.58s 1.62s
Bind Time 0.75s (± 0.66%) 0.76s (± 1.38%) +0.01s (+ 0.66%) 0.75s 0.79s
Check Time 5.97s (± 0.34%) 5.99s (± 0.78%) +0.01s (+ 0.20%) 5.86s 6.11s
Emit Time 3.28s (± 0.68%) 3.27s (± 0.60%) -0.01s (- 0.46%) 3.23s 3.32s
Total Time 11.62s (± 0.20%) 11.61s (± 0.43%) -0.00s (- 0.03%) 11.49s 11.75s
TFS - node (v10.16.3, x64)
Memory used 305,171k (± 0.02%) 305,146k (± 0.01%) -25k (- 0.01%) 305,080k 305,238k
Parse Time 1.29s (± 0.64%) 1.28s (± 0.59%) -0.00s (- 0.08%) 1.27s 1.30s
Bind Time 0.72s (± 0.31%) 0.72s (± 0.92%) -0.00s (- 0.14%) 0.71s 0.73s
Check Time 5.47s (± 0.55%) 5.42s (± 0.79%) -0.04s (- 0.75%) 5.34s 5.55s
Emit Time 3.42s (± 1.00%) 3.43s (± 0.89%) +0.00s (+ 0.12%) 3.35s 3.49s
Total Time 10.89s (± 0.54%) 10.86s (± 0.56%) -0.04s (- 0.33%) 10.73s 11.00s
material-ui - node (v10.16.3, x64)
Memory used 469,411k (± 0.01%) 469,389k (± 0.01%) -22k (- 0.00%) 469,258k 469,492k
Parse Time 1.84s (± 0.74%) 1.82s (± 0.33%) -0.02s (- 0.87%) 1.81s 1.84s
Bind Time 0.68s (± 1.74%) 0.69s (± 1.22%) +0.01s (+ 1.03%) 0.66s 0.70s
Check Time 14.54s (± 0.61%) 14.52s (± 0.67%) -0.03s (- 0.20%) 14.34s 14.74s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 17.07s (± 0.56%) 17.03s (± 0.57%) -0.03s (- 0.20%) 16.85s 17.27s
xstate - node (v10.16.3, x64)
Memory used 578,019k (± 0.01%) 581,349k (± 1.26%) +3,330k (+ 0.58%) 577,970k 610,928k
Parse Time 2.60s (± 0.45%) 2.60s (± 0.36%) -0.00s (- 0.04%) 2.58s 2.62s
Bind Time 1.03s (± 0.88%) 1.03s (± 1.01%) +0.00s (+ 0.10%) 1.02s 1.07s
Check Time 1.56s (± 0.71%) 1.58s (± 0.71%) +0.02s (+ 1.22%) 1.57s 1.62s
Emit Time 0.07s (± 4.13%) 0.07s (± 0.00%) -0.00s (- 2.78%) 0.07s 0.07s
Total Time 5.26s (± 0.42%) 5.27s (± 0.32%) +0.02s (+ 0.30%) 5.24s 5.32s
Angular - node (v12.1.0, x64)
Memory used 337,758k (± 0.03%) 337,629k (± 0.08%) -129k (- 0.04%) 336,528k 337,877k
Parse Time 2.09s (± 0.62%) 2.09s (± 0.34%) -0.01s (- 0.24%) 2.08s 2.11s
Bind Time 0.86s (± 0.95%) 0.86s (± 0.78%) 0.00s ( 0.00%) 0.84s 0.87s
Check Time 5.81s (± 0.57%) 5.82s (± 0.69%) +0.01s (+ 0.12%) 5.77s 5.97s
Emit Time 6.36s (± 0.61%) 6.39s (± 0.90%) +0.04s (+ 0.57%) 6.28s 6.58s
Total Time 15.13s (± 0.44%) 15.16s (± 0.59%) +0.04s (+ 0.23%) 15.04s 15.49s
Compiler-Unions - node (v12.1.0, x64)
Memory used 194,506k (± 0.02%) 194,400k (± 0.08%) -106k (- 0.05%) 193,835k 194,601k
Parse Time 0.82s (± 0.83%) 0.82s (± 0.60%) 0.00s ( 0.00%) 0.82s 0.84s
Bind Time 0.55s (± 1.06%) 0.54s (± 1.37%) -0.00s (- 0.73%) 0.53s 0.56s
Check Time 6.66s (± 0.69%) 6.67s (± 0.58%) +0.01s (+ 0.17%) 6.59s 6.77s
Emit Time 2.52s (± 0.97%) 2.52s (± 1.02%) +0.00s (+ 0.12%) 2.48s 2.59s
Total Time 10.56s (± 0.47%) 10.57s (± 0.43%) +0.01s (+ 0.09%) 10.50s 10.70s
Monaco - node (v12.1.0, x64)
Memory used 326,757k (± 0.02%) 326,846k (± 0.03%) +90k (+ 0.03%) 326,633k 327,030k
Parse Time 1.57s (± 0.82%) 1.56s (± 0.68%) -0.01s (- 0.63%) 1.54s 1.58s
Bind Time 0.74s (± 0.60%) 0.74s (± 0.65%) -0.00s (- 0.67%) 0.73s 0.75s
Check Time 5.79s (± 0.29%) 5.77s (± 0.36%) -0.02s (- 0.40%) 5.74s 5.82s
Emit Time 3.29s (± 0.82%) 3.29s (± 0.61%) -0.00s (- 0.00%) 3.26s 3.34s
Total Time 11.40s (± 0.34%) 11.36s (± 0.29%) -0.04s (- 0.34%) 11.30s 11.44s
TFS - node (v12.1.0, x64)
Memory used 289,771k (± 0.03%) 289,773k (± 0.02%) +2k (+ 0.00%) 289,655k 289,958k
Parse Time 1.30s (± 1.11%) 1.30s (± 0.80%) +0.00s (+ 0.00%) 1.28s 1.33s
Bind Time 0.71s (± 0.96%) 0.71s (± 0.91%) -0.00s (- 0.42%) 0.70s 0.73s
Check Time 5.35s (± 0.46%) 5.35s (± 0.32%) -0.00s (- 0.02%) 5.31s 5.38s
Emit Time 3.52s (± 0.92%) 3.54s (± 0.74%) +0.02s (+ 0.51%) 3.47s 3.59s
Total Time 10.88s (± 0.55%) 10.90s (± 0.28%) +0.02s (+ 0.16%) 10.80s 10.95s
material-ui - node (v12.1.0, x64)
Memory used 448,461k (± 0.01%) 448,559k (± 0.02%) +97k (+ 0.02%) 448,384k 448,685k
Parse Time 1.82s (± 0.45%) 1.82s (± 0.37%) -0.00s (- 0.05%) 1.81s 1.84s
Bind Time 0.67s (± 0.83%) 0.67s (± 0.66%) -0.00s (- 0.00%) 0.66s 0.68s
Check Time 13.00s (± 0.68%) 13.01s (± 0.42%) +0.01s (+ 0.05%) 12.91s 13.16s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.50s (± 0.56%) 15.51s (± 0.36%) +0.01s (+ 0.06%) 15.41s 15.66s
xstate - node (v12.1.0, x64)
Memory used 543,479k (± 0.01%) 546,609k (± 1.31%) +3,131k (+ 0.58%) 543,138k 575,594k
Parse Time 2.54s (± 0.33%) 2.55s (± 0.58%) +0.00s (+ 0.20%) 2.52s 2.59s
Bind Time 1.03s (± 1.21%) 1.03s (± 1.27%) +0.00s (+ 0.10%) 1.00s 1.07s
Check Time 1.51s (± 0.70%) 1.50s (± 0.47%) -0.01s (- 0.40%) 1.49s 1.52s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 5.16s (± 0.30%) 5.15s (± 0.44%) -0.00s (- 0.08%) 5.11s 5.21s
Angular - node (v14.15.1, x64)
Memory used 335,930k (± 0.01%) 335,930k (± 0.01%) +1k (+ 0.00%) 335,865k 335,976k
Parse Time 2.07s (± 0.84%) 2.05s (± 0.56%) -0.02s (- 0.82%) 2.02s 2.08s
Bind Time 0.89s (± 0.53%) 0.89s (± 0.45%) +0.00s (+ 0.11%) 0.88s 0.90s
Check Time 5.82s (± 0.30%) 5.81s (± 0.34%) -0.01s (- 0.19%) 5.77s 5.85s
Emit Time 6.42s (± 1.31%) 6.33s (± 0.63%) -0.08s (- 1.26%) 6.27s 6.46s
Total Time 15.20s (± 0.60%) 15.09s (± 0.39%) -0.12s (- 0.76%) 14.99s 15.24s
Compiler-Unions - node (v14.15.1, x64)
Memory used 193,116k (± 0.02%) 193,111k (± 0.01%) -5k (- 0.00%) 193,030k 193,176k
Parse Time 0.85s (± 0.61%) 0.85s (± 0.66%) -0.00s (- 0.12%) 0.84s 0.86s
Bind Time 0.57s (± 1.17%) 0.57s (± 1.01%) -0.00s (- 0.00%) 0.56s 0.58s
Check Time 6.74s (± 0.42%) 6.71s (± 0.42%) -0.04s (- 0.53%) 6.61s 6.75s
Emit Time 2.51s (± 0.73%) 2.47s (± 0.41%) -0.04s (- 1.44%) 2.45s 2.49s
Total Time 10.67s (± 0.40%) 10.59s (± 0.28%) -0.08s (- 0.70%) 10.49s 10.64s
Monaco - node (v14.15.1, x64)
Memory used 325,639k (± 0.01%) 325,646k (± 0.00%) +7k (+ 0.00%) 325,607k 325,682k
Parse Time 1.57s (± 0.54%) 1.58s (± 0.51%) +0.01s (+ 0.45%) 1.56s 1.60s
Bind Time 0.78s (± 0.60%) 0.78s (± 0.38%) +0.00s (+ 0.26%) 0.78s 0.79s
Check Time 5.66s (± 0.47%) 5.73s (± 0.55%) +0.07s (+ 1.17%) 5.67s 5.80s
Emit Time 3.35s (± 0.63%) 3.37s (± 0.72%) +0.02s (+ 0.63%) 3.32s 3.42s
Total Time 11.37s (± 0.37%) 11.46s (± 0.47%) +0.09s (+ 0.82%) 11.36s 11.58s
TFS - node (v14.15.1, x64)
Memory used 288,799k (± 0.01%) 288,814k (± 0.00%) +15k (+ 0.01%) 288,789k 288,842k
Parse Time 1.34s (± 1.11%) 1.35s (± 2.21%) +0.01s (+ 0.45%) 1.29s 1.42s
Bind Time 0.74s (± 0.70%) 0.75s (± 3.69%) +0.01s (+ 1.62%) 0.73s 0.86s
Check Time 5.35s (± 0.51%) 5.35s (± 0.56%) -0.00s (- 0.04%) 5.29s 5.40s
Emit Time 3.58s (± 2.36%) 3.58s (± 2.31%) +0.00s (+ 0.14%) 3.45s 3.77s
Total Time 11.00s (± 0.77%) 11.03s (± 0.46%) +0.02s (+ 0.19%) 10.96s 11.17s
material-ui - node (v14.15.1, x64)
Memory used 446,729k (± 0.00%) 446,721k (± 0.01%) -8k (- 0.00%) 446,635k 446,774k
Parse Time 1.87s (± 0.40%) 1.87s (± 0.44%) -0.00s (- 0.21%) 1.85s 1.89s
Bind Time 0.71s (± 1.41%) 0.73s (± 0.68%) +0.01s (+ 1.54%) 0.72s 0.74s
Check Time 13.12s (± 0.65%) 13.14s (± 0.47%) +0.02s (+ 0.13%) 13.05s 13.34s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.71s (± 0.50%) 15.74s (± 0.41%) +0.02s (+ 0.16%) 15.64s 15.94s
xstate - node (v14.15.1, x64)
Memory used 541,324k (± 0.00%) 541,328k (± 0.00%) +4k (+ 0.00%) 541,276k 541,377k
Parse Time 2.61s (± 0.63%) 2.60s (± 0.40%) -0.01s (- 0.42%) 2.58s 2.62s
Bind Time 1.15s (± 1.17%) 1.15s (± 1.19%) -0.00s (- 0.09%) 1.12s 1.18s
Check Time 1.55s (± 0.52%) 1.55s (± 0.44%) +0.00s (+ 0.26%) 1.55s 1.58s
Emit Time 0.07s (± 4.66%) 0.07s (± 4.66%) 0.00s ( 0.00%) 0.07s 0.08s
Total Time 5.38s (± 0.38%) 5.37s (± 0.30%) -0.01s (- 0.20%) 5.32s 5.40s
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 49956 10
Baseline main 10

TSServer

Comparison Report - main..49956
Metric main 49956 Delta Best Worst
Compiler-UnionsTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 1,456ms (± 0.40%) 1,450ms (± 0.42%) -6ms (- 0.41%) 1,436ms 1,462ms
Req 2 - geterr 3,614ms (± 0.66%) 3,619ms (± 0.46%) +5ms (+ 0.14%) 3,572ms 3,652ms
Req 3 - references 280ms (± 1.52%) 277ms (± 1.40%) -3ms (- 1.04%) 270ms 288ms
Req 4 - navto 231ms (± 1.03%) 231ms (± 0.75%) -0ms (- 0.17%) 227ms 234ms
Req 5 - completionInfo count 1,355 (± 0.00%) 1,355 (± 0.00%) 0 ( 0.00%) 1,355 1,355
Req 5 - completionInfo 67ms (± 8.83%) 70ms (±10.07%) +3ms (+ 4.77%) 62ms 90ms
CompilerTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 1,560ms (± 0.28%) 1,555ms (± 0.38%) -5ms (- 0.29%) 1,546ms 1,574ms
Req 2 - geterr 2,276ms (± 0.56%) 2,271ms (± 0.41%) -5ms (- 0.21%) 2,246ms 2,285ms
Req 3 - references 299ms (± 1.02%) 300ms (± 1.67%) +1ms (+ 0.20%) 293ms 313ms
Req 4 - navto 234ms (± 1.86%) 237ms (± 2.02%) +2ms (+ 0.94%) 224ms 247ms
Req 5 - completionInfo count 1,517 (± 0.00%) 1,517 (± 0.00%) 0 ( 0.00%) 1,517 1,517
Req 5 - completionInfo 69ms (± 1.55%) 69ms (± 1.12%) +1ms (+ 0.73%) 68ms 71ms
xstateTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 2,152ms (± 0.48%) 2,165ms (± 0.40%) +14ms (+ 0.64%) 2,150ms 2,187ms
Req 2 - geterr 775ms (± 0.76%) 773ms (± 0.61%) -2ms (- 0.30%) 763ms 783ms
Req 3 - references 97ms (± 1.25%) 96ms (± 1.00%) -1ms (- 1.14%) 93ms 97ms
Req 4 - navto 252ms (± 0.82%) 253ms (± 0.66%) +1ms (+ 0.32%) 247ms 255ms
Req 5 - completionInfo count 3,244 (± 0.00%) 3,244 (± 0.00%) 0 ( 0.00%) 3,244 3,244
Req 5 - completionInfo 271ms (± 1.44%) 273ms (± 1.24%) +2ms (+ 0.59%) 265ms 279ms
Compiler-UnionsTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 1,486ms (± 0.59%) 1,472ms (± 0.69%) -14ms (- 0.95%) 1,451ms 1,495ms
Req 2 - geterr 3,424ms (± 0.48%) 3,387ms (± 0.36%) -36ms (- 1.06%) 3,358ms 3,414ms
Req 3 - references 262ms (± 0.73%) 263ms (± 0.89%) +0ms (+ 0.08%) 259ms 270ms
Req 4 - navto 204ms (± 1.00%) 202ms (± 0.66%) -1ms (- 0.69%) 200ms 206ms
Req 5 - completionInfo count 1,355 (± 0.00%) 1,355 (± 0.00%) 0 ( 0.00%) 1,355 1,355
Req 5 - completionInfo 78ms (±15.92%) 72ms (±14.34%) 🟩-6ms (- 8.10%) 54ms 92ms
CompilerTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 1,564ms (± 0.40%) 1,562ms (± 0.54%) -2ms (- 0.12%) 1,545ms 1,583ms
Req 2 - geterr 2,214ms (± 0.62%) 2,213ms (± 0.32%) -2ms (- 0.08%) 2,199ms 2,231ms
Req 3 - references 272ms (± 0.48%) 272ms (± 0.89%) 0ms ( 0.00%) 268ms 278ms
Req 4 - navto 214ms (± 0.88%) 214ms (± 0.69%) -0ms (- 0.05%) 211ms 218ms
Req 5 - completionInfo count 1,517 (± 0.00%) 1,517 (± 0.00%) 0 ( 0.00%) 1,517 1,517
Req 5 - completionInfo 64ms (± 3.39%) 62ms (± 4.51%) -2ms (- 2.52%) 55ms 66ms
xstateTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 2,092ms (± 0.56%) 2,098ms (± 0.56%) +7ms (+ 0.32%) 2,065ms 2,121ms
Req 2 - geterr 757ms (± 0.52%) 760ms (± 0.36%) +3ms (+ 0.40%) 756ms 766ms
Req 3 - references 66ms (± 0.67%) 66ms (± 1.01%) +0ms (+ 0.15%) 65ms 68ms
Req 4 - navto 241ms (± 0.64%) 242ms (± 0.50%) +0ms (+ 0.17%) 240ms 245ms
Req 5 - completionInfo count 3,244 (± 0.00%) 3,244 (± 0.00%) 0 ( 0.00%) 3,244 3,244
Req 5 - completionInfo 260ms (± 0.79%) 261ms (± 0.80%) +1ms (+ 0.27%) 257ms 266ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 1,520ms (± 0.47%) 1,528ms (± 0.45%) +8ms (+ 0.49%) 1,509ms 1,542ms
Req 2 - geterr 3,519ms (± 0.48%) 3,514ms (± 0.54%) -5ms (- 0.13%) 3,470ms 3,548ms
Req 3 - references 275ms (± 0.72%) 275ms (± 0.56%) -1ms (- 0.18%) 271ms 279ms
Req 4 - navto 218ms (± 0.70%) 218ms (± 0.71%) +0ms (+ 0.09%) 215ms 222ms
Req 5 - completionInfo count 1,355 (± 0.00%) 1,355 (± 0.00%) 0 ( 0.00%) 1,355 1,355
Req 5 - completionInfo 58ms (± 5.79%) 58ms (± 4.86%) -0ms (- 0.17%) 55ms 65ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 1,601ms (± 0.67%) 1,600ms (± 0.34%) -0ms (- 0.01%) 1,589ms 1,611ms
Req 2 - geterr 2,337ms (± 0.44%) 2,340ms (± 0.32%) +3ms (+ 0.14%) 2,324ms 2,360ms
Req 3 - references 287ms (± 1.07%) 285ms (± 0.85%) -1ms (- 0.49%) 281ms 292ms
Req 4 - navto 232ms (± 1.79%) 230ms (± 1.63%) -2ms (- 0.78%) 227ms 245ms
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 (± 0.65%) -0ms (- 0.38%) 52ms 53ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 2,220ms (± 0.50%) 2,222ms (± 0.30%) +2ms (+ 0.07%) 2,210ms 2,235ms
Req 2 - geterr 773ms (± 0.45%) 772ms (± 0.33%) -1ms (- 0.06%) 766ms 778ms
Req 3 - references 65ms (± 1.39%) 65ms (± 1.28%) -1ms (- 0.77%) 63ms 67ms
Req 4 - navto 250ms (± 1.01%) 249ms (± 0.30%) -1ms (- 0.32%) 248ms 251ms
Req 5 - completionInfo count 3,244 (± 0.00%) 3,244 (± 0.00%) 0 ( 0.00%) 3,244 3,244
Req 5 - completionInfo 263ms (± 0.48%) 264ms (± 0.60%) +1ms (+ 0.27%) 261ms 267ms
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
  • 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 49956 10
Baseline main 10

Developer Information:

Download Benchmark

@jakebailey
Copy link
Member Author

Perf looks the same to my eye. Any opinions on where I do the normalization? Hoping to get this one in sooner rather than later just because it's causing so many problems in things like zod (and how bad it is to be allowing assignments of type variables bound by aliases to any union type).

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.

Looks good to me, but @weswigham or @ahejlsberg should take a look too.

Copy link
Member

@ahejlsberg ahejlsberg left a comment

Choose a reason for hiding this comment

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

This looks like a good fix. At some point we may want to do some deeper thinking about normalizing types into forms that don't require the additional getEffectiveConstraintOfIntersection check.

@jakebailey
Copy link
Member Author

jakebailey commented Jul 27, 2022

Alright, I'll leave this as-is, then, with Daniel's comment move suggestion.

@jakebailey jakebailey merged commit 8d0c72d into microsoft:main Jul 27, 2022
@jakebailey jakebailey deleted the fix-49937 branch July 27, 2022 17:06
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.

Type parameters constrained to type alias of generic class can't be used with instanceof - TypeScript 4.8 regression
5 participants