Relating large unions of literal types performs poorly #53191
Labels
Domain: Performance
Reports of unusually slow behavior
Fix Available
A PR has been opened for this issue
Milestone
π Version & Regression Information
All versions.
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The example above takes ~45s to compile on a reasonably fast machine. The underlying issue is that as we relate large unions of primitive types, we have a fast path for matches, but not for mismatches. Because the majority of the constituents of
TXXXXX
are not present inT9XXXX
, we spend a lot of time in the slow path that attempts to find matches by iterating through all constituents.π Expected behavior
We can do much better by implementing a fast path for mismatches.
The text was updated successfully, but these errors were encountered: