-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix perf regression from #42556 #43949
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
PR microsoft#42556 was a nice optimization that dramatically sped up comparisons of discriminated unions. Unfortunately, the cost of determining whether a union is discriminated can be prohibitively high. In particular, an internal team with a very large repo saw their type count double and their memory usage increase from 6GB to 9GB, breaking their build. This changes splits the difference by not trying to compute the property types of intersection types - a notoriously slow operation.
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.
IIRC, the fail case is not using this fast path for identifying which union member to compare to, so this seems fine; though it's maybe worth noting that changes to the input program (namely some more comparisons between types) could make it potentially bloom to this size anyway, since it's not like we were manifesting anything that might not have been made manifest for other checks.
@weswigham I think you're pointing out that this will slow down some compilations (those that would have tugged on the properties anyway and were using discriminated unions), but only to the performance they were at before #42556. Did I get that right? |
Yeah. |
@typescript-bot perf test this |
Heya @DanielRosenwasser, I've started to run the perf test suite on this PR at abfa620. You can monitor the build here. Update: The results are in! |
@ahejlsberg we'd like to land this for the RC in case you want to take a quick look. |
@DanielRosenwasser Here they are:Comparison Report - master..43949
System
Hosts
Scenarios
Developer Information: |
PR #42556 was a nice optimization that dramatically sped up comparisons of discriminated unions. Unfortunately, the cost of determining whether a union is discriminated can be prohibitively high. In particular, an internal team with a very large repo saw their type count double and their memory usage increase from 6GB to 9GB, breaking their build. This changes splits the difference by not trying to compute the property types of intersection types - a notoriously slow operation.
Fixes #