-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Cache getConstraintOfDistributiveConditionalType #53358
Cache getConstraintOfDistributiveConditionalType #53358
Conversation
@typescript-bot test this |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 5301906. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 5301906. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 5301906. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 5301906. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 5301906. You can monitor the build here. |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
@jakebailey Here they are:Comparison Report - main..53358
System
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @jakebailey, the results of running the DT tests are ready. |
src/compiler/types.ts
Outdated
@@ -6630,6 +6630,8 @@ export interface ConditionalType extends InstantiableType { | |||
/** @internal */ | |||
resolvedDefaultConstraint?: Type; | |||
/** @internal */ | |||
resolvedDefaultConstraintOfDistributed?: Type | false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolvedDefaultConstraintOfDistributed?: Type | false; | |
resolvedDefaultConstraintOfDistributive?: Type | false; | |
it'd be weird to not match the function name, y'know. Plus, a distributive conditional we're getting the distributive constraint of can't have been distributed yet, since, if it was, we wouldn't have a distributive conditional anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, then maybe this should really just be resolvedConstraintOfDistributive
to match the function? I think I brainfarted when copying the declaration above to rename it and just kept the word "default" without thinking about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to the straight substring of the function name, which isn't exactly what you said but I think is actually correct.
For #51188
In the perf graphs of #53346, a lot of the time is spent in
getConstraintOfDistributiveConditionalType
. We can cache it likegetDefaultConstraintOfConditionalType
. This function can return undefined, so we have to use a different value thanundefined
to indicate this case (as undefined is "not yet calculated").On top of main, this nets:
This compounds with #53346; both together nets: