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

Fixed an issue with not being able to use mapped type over union constraint as rest param #49947

Conversation

Andarist
Copy link
Contributor

Fixes a repro case mentioned in this comment #29919 (comment) but I don't think that it fixes the issue as a whole.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jul 19, 2022
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@Andarist Andarist force-pushed the fix/rest-param-using-mapped-type-over-union-constraint branch from 778e73c to 6554965 Compare July 19, 2022 08:29
@@ -19860,7 +19860,7 @@ namespace ts {
return varianceResult;
}
}
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
else if (isReadonlyArrayType(target) ? everyType(source, isArrayOrTupleType) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a good chance that this should do the same thing in the whenFalse branch of this ternary expression:

Suggested change
else if (isReadonlyArrayType(target) ? everyType(source, isArrayOrTupleType) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
else if (isReadonlyArrayType(target) ? everyType(source, isArrayOrTupleType) : isArrayType(target) && everyType(source, isTupleType) && !source.target.readonly) {

but to make such a change I will have to figure out a test case validating it. I don't think it's going to be super hard but my available time is limited rn.

Copy link
Member

Choose a reason for hiding this comment

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

The false branch is just for read-only types, so yeah, it should probably be the same, otherwise it'll work for non-readonly tuples, but not readonly ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed out a fix and tests for this.

Comment on lines 6 to 8
type Mapped<T> = { [P in keyof T]: T[P] extends string ? [number] : [string] }

declare function test<T extends [number] | [string]>(
Copy link
Member

Choose a reason for hiding this comment

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

This repro is a lot easier to understand for me because it has fewer moving parts and fewer repeated identifier, so it's easier to tell what dependencies exist between elements:

declare function test<T extends [number] | []>(
    fn: (...args: { [_ in keyof T]: [boolean] | [string] }) => void
): number

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with the fact that the proposed version is more succinct but at the same time, I don't feel like the added test case is overly verbose. For me personally, this is a little bit harder to read because it's less "usual". The inlined mapped type also doesn't make it completely obvious to me if this mapped type is still homomorphic or not (although that's just my lack of expertise).

Overall, I don't mind making a change but perhaps it would be good to have some guidelines in the CONTRIBUTING.md for how one should write tests etc. For an external contributor like me, it's not that obvious what kind of tests are preferred by the team.

Please let me know if I should adjust the test, add a new one or leave it as is.

@weswigham
Copy link
Member

Just needs a resync with main and a DT run, just to check.

…mapped-type-over-union-constraint

# Conflicts:
#	src/compiler/checker.ts
@Andarist
Copy link
Contributor Author

synced this with main, could you rerun the tests?

@jakebailey
Copy link
Member

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2023

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2023

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

Update: The results are in!

@jakebailey
Copy link
Member

I should have waited for the test run, I guess; PR seems to be erroring.

@Andarist
Copy link
Contributor Author

Andarist commented Mar 16, 2023

Eh, it seems that this change conflicts with the merged #52651 . I will have to investigate this and report back sometime later.

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..49947

Metric main 49947 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 360,900k (± 0.01%) 360,886k (± 0.01%) ~ 360,845k 360,926k p=0.471 n=6
Parse Time 3.51s (± 0.61%) 3.53s (± 0.23%) ~ 3.52s 3.54s p=0.157 n=6
Bind Time 1.18s (± 0.64%) 1.18s (± 0.46%) ~ 1.18s 1.19s p=0.476 n=6
Check Time 9.46s (± 0.44%) 9.51s (± 0.66%) ~ 9.43s 9.59s p=0.419 n=6
Emit Time 7.93s (± 0.92%) 7.93s (± 0.39%) ~ 7.90s 7.98s p=0.332 n=6
Total Time 22.09s (± 0.37%) 22.15s (± 0.16%) ~ 22.12s 22.20s p=0.065 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 193,106k (± 0.69%) 193,086k (± 0.71%) ~ 192,467k 195,881k p=0.471 n=6
Parse Time 1.57s (± 1.47%) 1.57s (± 1.83%) ~ 1.52s 1.60s p=0.517 n=6
Bind Time 0.82s (± 0.00%) 0.82s (± 0.63%) ~ 0.82s 0.83s p=0.174 n=6
Check Time 10.04s (± 0.51%) 10.04s (± 0.43%) ~ 10.00s 10.11s p=0.809 n=6
Emit Time 2.97s (± 0.98%) 2.99s (± 0.96%) ~ 2.96s 3.03s p=0.198 n=6
Total Time 15.40s (± 0.52%) 15.43s (± 0.49%) ~ 15.31s 15.53s p=0.574 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,435k (± 0.01%) 345,438k (± 0.00%) ~ 345,421k 345,459k p=0.748 n=6
Parse Time 2.73s (± 0.50%) 2.74s (± 0.38%) ~ 2.72s 2.75s p=0.680 n=6
Bind Time 1.09s (± 0.75%) 1.09s (± 0.37%) ~ 1.08s 1.09s p=1.000 n=6
Check Time 7.67s (± 0.27%) 7.72s (± 0.50%) +0.04s (+ 0.56%) 7.68s 7.77s p=0.036 n=6
Emit Time 4.44s (± 0.74%) 4.44s (± 0.79%) ~ 4.39s 4.49s p=0.809 n=6
Total Time 15.94s (± 0.34%) 15.98s (± 0.11%) ~ 15.96s 16.01s p=0.259 n=6
TFS - node (v16.17.1, x64)
Memory used 299,780k (± 0.00%) 299,779k (± 0.01%) ~ 299,753k 299,830k p=0.630 n=6
Parse Time 2.18s (± 0.75%) 2.18s (± 0.47%) ~ 2.16s 2.19s p=0.492 n=6
Bind Time 1.24s (± 0.41%) 1.24s (± 0.83%) ~ 1.23s 1.26s p=0.928 n=6
Check Time 7.20s (± 0.56%) 7.17s (± 0.64%) ~ 7.09s 7.22s p=0.333 n=6
Emit Time 4.35s (± 0.69%) 4.35s (± 1.25%) ~ 4.30s 4.44s p=0.746 n=6
Total Time 14.97s (± 0.53%) 14.93s (± 0.43%) ~ 14.84s 15.01s p=0.468 n=6
material-ui - node (v16.17.1, x64)
Memory used 477,434k (± 0.01%) 477,505k (± 0.01%) +70k (+ 0.01%) 477,466k 477,557k p=0.045 n=6
Parse Time 3.23s (± 0.32%) 3.20s (± 0.91%) ~ 3.17s 3.24s p=0.162 n=6
Bind Time 0.96s (± 0.54%) 0.96s (± 1.83%) ~ 0.94s 0.99s p=0.437 n=6
Check Time 18.08s (± 0.53%) 18.07s (± 0.48%) ~ 17.94s 18.17s p=0.873 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.26s (± 0.45%) 22.22s (± 0.51%) ~ 22.06s 22.35s p=0.689 n=6
xstate - node (v16.17.1, x64)
Memory used 550,637k (± 0.01%) 550,677k (± 0.01%) ~ 550,614k 550,794k p=0.470 n=6
Parse Time 3.95s (± 0.34%) 3.96s (± 0.49%) ~ 3.94s 3.99s p=0.560 n=6
Bind Time 1.80s (± 0.50%) 1.79s (± 0.89%) ~ 1.77s 1.81s p=0.214 n=6
Check Time 3.04s (± 1.14%) 3.03s (± 1.02%) ~ 3.00s 3.07s p=0.629 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 8.88s (± 0.44%) 8.87s (± 0.49%) ~ 8.80s 8.91s p=0.574 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 49947 6
Baseline main 6

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, it looks like the DT test run failed. Please check the log for more details.
You can check the log here.

…aints but avoid resolving the apparent type of mapped types for contextual types
@@ -13861,7 +13861,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const typeVariable = getHomomorphicTypeVariable(type);
if (typeVariable && !type.declaration.nameType) {
const constraint = getConstraintOfTypeParameter(typeVariable);
if (constraint && isArrayType(constraint)) {
if (constraint && everyType(constraint, isArrayType)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a way, this reverts the recent change from #52651 . That issue is now fixed by avoiding getting the apparent type of mapped types within getApparentTypeOfContextualType - you can see the change in the commit here

I think this is a better fix for that issue anyway, I just didn't figure it out earlier. Getting the "resolved" apparent type for mapped types with tuple constraint (and array) constraints is important for relationship checking. The mapped type that resolves~ to a tuple is usually "normalized" here, that allows tuple/array-oriented branches to relate things.

// That would evaluate mapped types with array or tuple type constraints too eagerly
// and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
// Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
t => getObjectFlags(t) & ObjectFlags.Mapped ? t : getApparentType(t),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might also need to handle intersections better, their mapped types parts should be left alone similarly. I don't have a test case to validate this at hand though so I refrained from making further changes to this. However, I think that I know how to write a sensible test case for this with the changes from this PR. So I would like to wait for one of them to land so I could tweak this part of the code and add the appropriate test case to the other PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And I pushed out this extra fix here: 56f12bc

Copy link
Member

Choose a reason for hiding this comment

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

Would you care to open a new PR for the further improvement? Since it comes with a test case proving it's utility, it looks pretty good - will just need to make sure the extended suites stay clean when that handling is in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I thought that this would be linked better - this commit is already part of the #52062 :) it only made sense for me to add this change there as that PR was already concerned with intersected mapped types and thus I already had an idea what a test to write there for this patch

Copy link
Member

Choose a reason for hiding this comment

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

Ahh, OK.

@Andarist
Copy link
Contributor Author

@jakebailey @weswigham I managed to resolve the conflict with #52651 by rolling back its changes and applying a different fix for the issue that it was fixing. Now every test passes again - the code has changed though so this might require an extra round of review + the extended test suite run :)

@jakebailey
Copy link
Member

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 19, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 19, 2023

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 19, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 19, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 19, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..49947
Metric main 49947 Delta Best Worst p-value
Angular - node (v18.10.0, x64)
Memory used 361,803k (± 0.00%) 361,720k (± 0.01%) -83k (- 0.02%) 361,648k 361,763k p=0.005 n=6
Parse Time 3.36s (± 0.36%) 3.38s (± 0.73%) ~ 3.35s 3.40s p=0.160 n=6
Bind Time 1.12s (± 1.08%) 1.12s (± 0.36%) ~ 1.11s 1.12s p=0.863 n=6
Check Time 8.71s (± 0.48%) 8.72s (± 0.20%) ~ 8.69s 8.74s p=0.744 n=6
Emit Time 7.44s (± 0.58%) 7.42s (± 0.34%) ~ 7.39s 7.46s p=0.412 n=6
Total Time 20.62s (± 0.41%) 20.63s (± 0.19%) ~ 20.56s 20.67s p=0.630 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used 191,765k (± 1.22%) 193,647k (± 1.60%) ~ 190,778k 196,487k p=0.471 n=6
Parse Time 1.50s (± 1.44%) 1.50s (± 1.48%) ~ 1.46s 1.52s p=0.935 n=6
Bind Time 0.77s (± 0.00%) 0.77s (± 0.82%) ~ 0.76s 0.78s p=1.000 n=6
Check Time 9.41s (± 0.68%) 9.39s (± 0.74%) ~ 9.34s 9.52s p=0.572 n=6
Emit Time 2.74s (± 1.29%) 2.74s (± 1.11%) ~ 2.70s 2.78s p=1.000 n=6
Total Time 14.42s (± 0.45%) 14.40s (± 0.58%) ~ 14.28s 14.51s p=0.936 n=6
Monaco - node (v18.10.0, x64)
Memory used 346,217k (± 0.01%) 346,293k (± 0.01%) +76k (+ 0.02%) 346,244k 346,319k p=0.008 n=6
Parse Time 2.58s (± 0.63%) 2.62s (± 1.12%) +0.04s (+ 1.35%) 2.59s 2.66s p=0.040 n=6
Bind Time 1.01s (± 0.74%) 1.01s (± 0.97%) ~ 1.00s 1.02s p=1.000 n=6
Check Time 6.98s (± 0.49%) 7.00s (± 0.62%) ~ 6.93s 7.05s p=0.466 n=6
Emit Time 4.23s (± 0.59%) 4.27s (± 0.70%) +0.04s (+ 0.94%) 4.22s 4.31s p=0.042 n=6
Total Time 14.81s (± 0.28%) 14.90s (± 0.63%) ~ 14.78s 15.01s p=0.078 n=6
TFS - node (v18.10.0, x64)
Memory used 300,489k (± 0.01%) 300,497k (± 0.01%) ~ 300,442k 300,524k p=0.575 n=6
Parse Time 2.07s (± 0.89%) 2.08s (± 1.34%) ~ 2.05s 2.12s p=0.418 n=6
Bind Time 1.13s (± 0.97%) 1.14s (± 0.55%) ~ 1.13s 1.15s p=0.081 n=6
Check Time 6.52s (± 0.52%) 6.53s (± 0.70%) ~ 6.46s 6.59s p=0.514 n=6
Emit Time 3.87s (± 0.48%) 3.88s (± 0.75%) ~ 3.85s 3.92s p=1.000 n=6
Total Time 13.59s (± 0.35%) 13.62s (± 0.59%) ~ 13.53s 13.75s p=0.688 n=6
material-ui - node (v18.10.0, x64)
Memory used 478,142k (± 0.00%) 477,157k (± 0.01%) -985k (- 0.21%) 477,107k 477,215k p=0.005 n=6
Parse Time 3.02s (± 3.05%) 3.01s (± 2.52%) ~ 2.93s 3.08s p=0.676 n=6
Bind Time 0.96s (± 8.73%) 0.99s (± 9.06%) ~ 0.90s 1.08s p=0.461 n=6
Check Time 17.09s (± 0.92%) 17.00s (± 0.61%) ~ 16.85s 17.16s p=0.336 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 21.08s (± 0.85%) 21.00s (± 0.49%) ~ 20.84s 21.13s p=0.689 n=6
xstate - node (v18.10.0, x64)
Memory used 553,268k (± 0.04%) 553,161k (± 0.03%) ~ 552,854k 553,332k p=0.936 n=6
Parse Time 3.76s (± 0.43%) 3.77s (± 0.34%) ~ 3.75s 3.78s p=0.402 n=6
Bind Time 1.68s (± 0.62%) 1.68s (± 0.65%) ~ 1.66s 1.69s p=0.554 n=6
Check Time 2.78s (± 0.59%) 2.81s (± 0.94%) +0.03s (+ 1.20%) 2.77s 2.84s p=0.043 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 8.31s (± 0.14%) 8.34s (± 0.50%) ~ 8.28s 8.39s p=0.147 n=6
Angular - node (v16.17.1, x64)
Memory used 361,130k (± 0.01%) 361,046k (± 0.01%) -84k (- 0.02%) 361,000k 361,114k p=0.013 n=6
Parse Time 3.54s (± 0.64%) 3.54s (± 0.79%) ~ 3.51s 3.59s p=0.627 n=6
Bind Time 1.18s (± 0.46%) 1.18s (± 0.44%) ~ 1.18s 1.19s p=0.640 n=6
Check Time 9.50s (± 0.57%) 9.47s (± 0.34%) ~ 9.43s 9.51s p=0.573 n=6
Emit Time 7.94s (± 0.74%) 7.89s (± 0.44%) ~ 7.85s 7.94s p=0.172 n=6
Total Time 22.16s (± 0.40%) 22.09s (± 0.28%) ~ 22.03s 22.18s p=0.092 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,596k (± 0.02%) 192,556k (± 0.03%) ~ 192,513k 192,651k p=0.471 n=6
Parse Time 1.56s (± 1.62%) 1.58s (± 1.31%) ~ 1.55s 1.60s p=0.226 n=6
Bind Time 0.82s (± 0.92%) 0.82s (± 0.00%) ~ 0.82s 0.82s p=0.598 n=6
Check Time 10.08s (± 0.63%) 10.10s (± 0.41%) ~ 10.06s 10.17s p=0.377 n=6
Emit Time 2.97s (± 0.72%) 2.99s (± 0.86%) ~ 2.96s 3.03s p=0.195 n=6
Total Time 15.43s (± 0.56%) 15.49s (± 0.27%) ~ 15.43s 15.53s p=0.199 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,520k (± 0.00%) 345,581k (± 0.01%) +60k (+ 0.02%) 345,547k 345,604k p=0.005 n=6
Parse Time 2.73s (± 0.36%) 2.74s (± 0.63%) ~ 2.72s 2.76s p=0.453 n=6
Bind Time 1.09s (± 0.96%) 1.09s (± 0.90%) ~ 1.08s 1.10s p=0.673 n=6
Check Time 7.67s (± 0.59%) 7.69s (± 0.52%) ~ 7.64s 7.75s p=0.470 n=6
Emit Time 4.44s (± 0.48%) 4.45s (± 0.61%) ~ 4.42s 4.48s p=0.557 n=6
Total Time 15.93s (± 0.37%) 15.98s (± 0.47%) ~ 15.87s 16.07s p=0.423 n=6
TFS - node (v16.17.1, x64)
Memory used 299,823k (± 0.01%) 299,827k (± 0.01%) ~ 299,808k 299,848k p=0.688 n=6
Parse Time 2.17s (± 0.45%) 2.18s (± 0.45%) ~ 2.17s 2.19s p=0.151 n=6
Bind Time 1.24s (± 0.79%) 1.24s (± 0.94%) ~ 1.22s 1.25s p=1.000 n=6
Check Time 7.17s (± 0.43%) 7.15s (± 0.48%) ~ 7.12s 7.19s p=0.566 n=6
Emit Time 4.36s (± 0.81%) 4.32s (± 0.43%) ~ 4.29s 4.34s p=0.252 n=6
Total Time 14.93s (± 0.30%) 14.89s (± 0.39%) ~ 14.80s 14.95s p=0.327 n=6
material-ui - node (v16.17.1, x64)
Memory used 477,491k (± 0.01%) 476,488k (± 0.02%) -1,003k (- 0.21%) 476,372k 476,585k p=0.005 n=6
Parse Time 3.22s (± 0.80%) 3.23s (± 1.15%) ~ 3.16s 3.27s p=0.373 n=6
Bind Time 0.96s (± 0.57%) 0.97s (± 2.23%) ~ 0.95s 1.01s p=0.201 n=6
Check Time 18.06s (± 0.47%) 17.91s (± 0.79%) ~ 17.76s 18.09s p=0.092 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.23s (± 0.32%) 22.10s (± 0.68%) ~ 21.95s 22.30s p=0.199 n=6
xstate - node (v16.17.1, x64)
Memory used 550,687k (± 0.01%) 550,605k (± 0.01%) -82k (- 0.01%) 550,567k 550,712k p=0.031 n=6
Parse Time 3.94s (± 0.26%) 3.95s (± 0.31%) ~ 3.94s 3.97s p=1.000 n=6
Bind Time 1.79s (± 0.65%) 1.79s (± 0.84%) ~ 1.78s 1.82s p=0.804 n=6
Check Time 3.03s (± 0.94%) 3.04s (± 0.68%) ~ 3.02s 3.07s p=0.625 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 8.86s (± 0.29%) 8.88s (± 0.18%) ~ 8.85s 8.89s p=0.087 n=6
Angular - node (v14.15.1, x64)
Memory used 354,893k (± 0.01%) 354,915k (± 0.01%) ~ 354,877k 354,954k p=0.173 n=6
Parse Time 3.57s (± 0.60%) 3.60s (± 0.54%) +0.03s (+ 0.84%) 3.58s 3.63s p=0.036 n=6
Bind Time 1.23s (± 0.61%) 1.24s (± 0.42%) ~ 1.23s 1.24s p=0.247 n=6
Check Time 9.76s (± 0.16%) 9.84s (± 0.26%) +0.08s (+ 0.85%) 9.81s 9.87s p=0.005 n=6
Emit Time 8.35s (± 0.55%) 8.36s (± 0.52%) ~ 8.31s 8.41s p=1.000 n=6
Total Time 22.91s (± 0.29%) 23.03s (± 0.20%) +0.12s (+ 0.52%) 22.95s 23.08s p=0.013 n=6
Compiler-Unions - node (v14.15.1, x64)
Memory used 187,768k (± 0.01%) 187,799k (± 0.01%) ~ 187,766k 187,844k p=0.093 n=6
Parse Time 1.60s (± 0.73%) 1.60s (± 0.39%) ~ 1.59s 1.61s p=1.000 n=6
Bind Time 0.85s (± 0.61%) 0.85s (± 0.99%) ~ 0.84s 0.86s p=0.533 n=6
Check Time 10.22s (± 0.42%) 10.20s (± 0.48%) ~ 10.15s 10.28s p=0.517 n=6
Emit Time 3.13s (± 0.87%) 3.12s (± 0.60%) ~ 3.09s 3.14s p=0.259 n=6
Total Time 15.81s (± 0.48%) 15.76s (± 0.37%) ~ 15.71s 15.86s p=0.378 n=6
Monaco - node (v14.15.1, x64)
Memory used 340,474k (± 0.01%) 340,568k (± 0.00%) +94k (+ 0.03%) 340,553k 340,584k p=0.005 n=6
Parse Time 2.84s (± 0.52%) 2.84s (± 0.50%) ~ 2.82s 2.86s p=0.870 n=6
Bind Time 1.11s (± 0.47%) 1.10s (± 0.68%) ~ 1.09s 1.11s p=0.247 n=6
Check Time 8.06s (± 0.48%) 8.08s (± 0.56%) ~ 8.03s 8.15s p=0.466 n=6
Emit Time 4.69s (± 0.83%) 4.68s (± 0.75%) ~ 4.64s 4.74s p=0.871 n=6
Total Time 16.70s (± 0.39%) 16.71s (± 0.45%) ~ 16.63s 16.82s p=1.000 n=6
TFS - node (v14.15.1, x64)
Memory used 294,911k (± 0.00%) 294,901k (± 0.01%) ~ 294,879k 294,932k p=0.298 n=6
Parse Time 2.40s (± 0.83%) 2.38s (± 0.27%) ~ 2.37s 2.39s p=0.059 n=6
Bind Time 1.07s (± 0.76%) 1.07s (± 0.38%) ~ 1.06s 1.07s p=0.584 n=6
Check Time 7.47s (± 0.38%) 7.48s (± 0.65%) ~ 7.40s 7.55s p=0.418 n=6
Emit Time 4.27s (± 0.64%) 4.29s (± 0.38%) ~ 4.27s 4.32s p=0.171 n=6
Total Time 15.22s (± 0.36%) 15.23s (± 0.33%) ~ 15.14s 15.29s p=0.935 n=6
material-ui - node (v14.15.1, x64)
Memory used 472,995k (± 0.00%) 472,003k (± 0.00%) -992k (- 0.21%) 471,972k 472,029k p=0.005 n=6
Parse Time 3.34s (± 0.24%) 3.36s (± 0.55%) ~ 3.33s 3.38s p=0.192 n=6
Bind Time 1.00s (± 0.54%) 1.00s (± 0.81%) ~ 0.99s 1.01s p=0.859 n=6
Check Time 18.94s (± 0.43%) 18.90s (± 0.63%) ~ 18.72s 19.04s p=0.520 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 23.29s (± 0.31%) 23.26s (± 0.52%) ~ 23.08s 23.39s p=0.810 n=6
xstate - node (v14.15.1, x64)
Memory used 539,265k (± 0.00%) 539,135k (± 0.00%) -130k (- 0.02%) 539,104k 539,149k p=0.005 n=6
Parse Time 4.23s (± 0.47%) 4.24s (± 0.18%) ~ 4.23s 4.25s p=0.087 n=6
Bind Time 1.67s (± 0.62%) 1.67s (± 0.50%) ~ 1.67s 1.69s p=0.788 n=6
Check Time 3.21s (± 0.91%) 3.19s (± 0.52%) ~ 3.17s 3.21s p=0.195 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 9.20s (± 0.43%) 9.20s (± 0.33%) ~ 9.15s 9.23s p=0.872 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 (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 49947 6
Baseline main 6

TSServer

Comparison Report - main..49947
Metric main 49947 Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,384ms (± 0.57%) 2,395ms (± 0.50%) ~ 2,379ms 2,413ms p=0.173 n=6
Req 2 - geterr 5,346ms (± 0.49%) 5,386ms (± 1.07%) ~ 5,328ms 5,476ms p=0.297 n=6
Req 3 - references 336ms (± 0.59%) 337ms (± 0.36%) ~ 335ms 338ms p=0.249 n=6
Req 4 - navto 281ms (± 0.95%) 280ms (± 0.61%) ~ 278ms 282ms p=0.934 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 81ms (± 2.69%) 75ms (± 7.44%) ~ 68ms 83ms p=0.061 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,528ms (± 0.78%) 2,514ms (± 0.63%) ~ 2,483ms 2,527ms p=0.470 n=6
Req 2 - geterr 4,015ms (± 0.50%) 4,007ms (± 0.64%) ~ 3,978ms 4,046ms p=0.470 n=6
Req 3 - references 351ms (± 1.42%) 349ms (± 0.99%) ~ 344ms 354ms p=0.335 n=6
Req 4 - navto 291ms (± 0.73%) 291ms (± 0.89%) ~ 287ms 293ms p=0.935 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 78ms (± 7.51%) 76ms (± 5.14%) ~ 70ms 80ms p=0.572 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 3,023ms (± 0.54%) 3,021ms (± 0.52%) ~ 3,008ms 3,048ms p=0.575 n=6
Req 2 - geterr 1,599ms (± 2.20%) 1,596ms (± 1.44%) ~ 1,579ms 1,642ms p=0.810 n=6
Req 3 - references 108ms (± 1.01%) 108ms (± 1.51%) ~ 106ms 110ms p=0.741 n=6
Req 4 - navto 357ms (± 0.33%) 356ms (± 0.54%) ~ 354ms 359ms p=0.291 n=6
Req 5 - completionInfo count 2,861 (± 0.00%) 2,861 (± 0.00%) ~ 2,861 2,861 p=1.000 n=6
Req 5 - completionInfo 385ms (± 0.91%) 383ms (± 1.74%) ~ 377ms 392ms p=0.334 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,508ms (± 0.92%) 2,520ms (± 0.87%) ~ 2,495ms 2,561ms p=0.378 n=6
Req 2 - geterr 5,754ms (± 0.75%) 5,770ms (± 0.73%) ~ 5,724ms 5,848ms p=0.378 n=6
Req 3 - references 347ms (± 0.47%) 349ms (± 0.83%) ~ 344ms 351ms p=0.256 n=6
Req 4 - navto 276ms (± 0.95%) 281ms (± 1.09%) +5ms (+ 1.87%) 278ms 286ms p=0.013 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 74ms (± 0.70%) 74ms (± 1.43%) ~ 72ms 75ms p=0.794 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,692ms (± 0.77%) 2,689ms (± 1.20%) ~ 2,656ms 2,746ms p=0.748 n=6
Req 2 - geterr 4,378ms (± 0.32%) 4,377ms (± 0.49%) ~ 4,340ms 4,401ms p=0.810 n=6
Req 3 - references 359ms (± 0.65%) 358ms (± 0.37%) ~ 357ms 360ms p=0.870 n=6
Req 4 - navto 290ms (± 0.53%) 291ms (± 0.26%) ~ 290ms 292ms p=0.404 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 74ms (± 6.22%) 76ms (± 2.82%) ~ 74ms 80ms p=0.934 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 3,168ms (± 0.36%) 3,175ms (± 0.31%) ~ 3,160ms 3,185ms p=0.230 n=6
Req 2 - geterr 1,760ms (± 0.70%) 1,768ms (± 1.50%) ~ 1,742ms 1,812ms p=1.000 n=6
Req 3 - references 117ms (± 0.84%) 117ms (± 1.32%) ~ 114ms 118ms p=0.667 n=6
Req 4 - navto 341ms (± 0.54%) 341ms (± 0.24%) ~ 339ms 341ms p=0.720 n=6
Req 5 - completionInfo count 2,861 (± 0.00%) 2,861 (± 0.00%) ~ 2,861 2,861 p=1.000 n=6
Req 5 - completionInfo 399ms (± 0.65%) 405ms (± 4.83%) ~ 394ms 445ms p=0.936 n=6
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 2,603ms (± 0.52%) 2,605ms (± 0.28%) ~ 2,596ms 2,618ms p=0.873 n=6
Req 2 - geterr 6,147ms (± 0.26%) 6,165ms (± 0.67%) ~ 6,110ms 6,210ms p=0.470 n=6
Req 3 - references 364ms (± 0.80%) 365ms (± 1.09%) ~ 361ms 371ms p=1.000 n=6
Req 4 - navto 276ms (± 0.51%) 279ms (± 1.50%) ~ 276ms 287ms p=0.139 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 102ms (± 0.88%) 100ms (± 5.23%) ~ 89ms 103ms p=0.273 n=6
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 2,822ms (± 0.53%) 2,821ms (± 0.38%) ~ 2,802ms 2,831ms p=1.000 n=6
Req 2 - geterr 4,585ms (± 2.83%) 4,575ms (± 2.23%) ~ 4,472ms 4,690ms p=0.936 n=6
Req 3 - references 401ms (± 7.82%) 392ms (± 7.13%) ~ 371ms 429ms p=0.687 n=6
Req 4 - navto 289ms (± 0.83%) 291ms (± 1.76%) ~ 286ms 300ms p=0.466 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 81ms (±10.54%) 80ms (±11.09%) ~ 73ms 91ms p=0.807 n=6
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 3,462ms (± 0.61%) 3,475ms (± 0.36%) ~ 3,459ms 3,490ms p=0.298 n=6
Req 2 - geterr 1,866ms (± 0.88%) 1,881ms (± 0.67%) ~ 1,867ms 1,902ms p=0.199 n=6
Req 3 - references 125ms (± 1.17%) 126ms (± 0.93%) ~ 124ms 127ms p=0.219 n=6
Req 4 - navto 371ms (± 0.46%) 370ms (± 0.58%) ~ 368ms 373ms p=0.365 n=6
Req 5 - completionInfo count 2,861 (± 0.00%) 2,861 (± 0.00%) ~ 2,861 2,861 p=1.000 n=6
Req 5 - completionInfo 412ms (± 0.60%) 409ms (± 0.84%) ~ 403ms 413ms p=0.077 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 (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.15.1, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.15.1, x64)
Benchmark Name Iterations
Current 49947 6
Baseline main 6

Startup

Comparison Report - main..49947
Metric main 49947 Delta Best Worst p-value
tsc-startup - node (v16.17.1, x64)
Execution time 141.20ms (± 0.15%) 141.66ms (± 0.16%) +0.46ms (+ 0.33%) 141.08ms 143.97ms p=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time 225.91ms (± 0.17%) 227.14ms (± 0.16%) +1.23ms (+ 0.55%) 226.24ms 231.75ms p=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time 227.93ms (± 0.21%) 228.71ms (± 0.15%) +0.78ms (+ 0.34%) 227.63ms 233.76ms p=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time 208.92ms (± 0.19%) 209.55ms (± 0.19%) +0.63ms (+ 0.30%) 208.68ms 219.92ms p=0.000 n=600
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
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
Benchmark Name Iterations
Current 49947 6
Baseline main 6

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants