-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Shortcut relations in getNarrowedTypeWorker when comparing literals #56072
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
base: main
Are you sure you want to change the base?
Conversation
@typescript-bot test top100 |
Heya @jakebailey, I've started to run the regular perf test suite on this PR at 54d0bc7. 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 54d0bc7. 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 54d0bc7. 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 54d0bc7. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 54d0bc7. You can monitor the build here. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@jakebailey Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
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. |
@typescript-bot perf test this |
Heya @jakebailey, I've started to run the regular perf test suite on this PR at 629de0d. You can monitor the build here. Update: The results are in! |
@jakebailey Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@typescript-bot test top200 |
Heya @jakebailey, I've started to run the regular perf test suite on this PR at e68e177. 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 e68e177. 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 e68e177. You can monitor the build here. Update: The results are in! |
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@jakebailey Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hm, not very good, probably because if we're already willing to pay the cost to do relations, it's not going to be very expensive to go through simpleTypeRelated or whatever. But in the other place, we're guaranteed to call relation 4 times when the types aren't related, which is expensive on large unions. |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
@typescript-bot perf test this |
Heya @jakebailey, I've started to run the regular perf test suite on this PR at f993810. You can monitor the build here. Update: The results are in! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey did the results indicate that this is worth pursuing? It is worth keeping open? |
You can see the relevant benchmark in the original post; our current test suite doesn't have a case like this. |
For #55948
When narrowing large unions of literals, we do four different relation calls which appear to be quite costly. By checking ahead of time that we're going to relate two literals, we can skip this work by comparing the values directly and only once (as the result shouldn't be order dependent).
This leads to a significant speedup on #55948:
This PR passes all of the tests, but I think my implementation is probably wrong for some edge cases.
Like, I don't validate that the literal types are the same between the two, just their values, which is wrong. But, doesn't break?Fixed that edge case.