-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add single-element fastpath to getSupertypeOrUnion #43934
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
Conversation
@typescript-bot perf test this |
Heya @weswigham, I've started to run the perf test suite on this PR at 8f460a8. You can monitor the build here. Update: The results are in! |
@weswigham Here they are:Comparison Report - master..43934
System
Hosts
Scenarios
Developer Information: |
Good, perf seems to be generally stable, and this seems to handle the outsized example in the linked issue. @typescript-bot pack this |
Heya @weswigham, I've started to run the tarball bundle task on this PR at 8f460a8. You can monitor the build here. |
Hey @weswigham, 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 |
@h-joo would you be able to try the above build out and see if/how much it helps your real codebase? |
Sure, I will let you know once I'm done testing. |
Confirmed that this commit fixes the issue. Thank you for the fix :) |
Thus avoiding the expensive calculations in
literalTypesWithSameBaseType
when it isn't actually needed.Fixes #43899, from what I can tell. Since it's a perf optimization, I don't really have a test, per-sey, other than my observed performance, since I couldn't scale the example in the issue to the point it'd crash even with tens of thousands of elements.