Repository navigation
Speed up union subset checks by scanning sorted constituents - #64964
Mateusz Burzyński (Andarist) wants to merge 3 commits into
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
There was a problem hiding this comment.
🟡 Changes recommended
Sparse subset checks now require linear rather than logarithmic search work against large target unions.
1 open issue
What changed in this PR
This PR changes union-subset checking in the native TypeScript checker to use a forward identity scan instead of repeated binary searches.
Changes:
- Rejects source unions with more members than the target.
- Searches progressively shorter target slices, relying on sorted union members.
| File | Description |
|---|---|
tsc/internal/checker/relater.go |
Replaces per-member binary searches with a forward scan and adds a size guard. |
Review effort: Balanced
69739e1 to
d2050ae
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…he previous match
d2050ae to
4c35db3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| } | ||
| return true | ||
| } | ||
| for _, t := range sourceTypes { |
There was a problem hiding this comment.
| for _, t := range sourceTypes { | |
| for _, t := range sourceTypes { |
This comment has been minimized.
This comment has been minimized.
|
TypeScript Bot (@typescript-bot) perf test this faster |
|
Jake Bailey (@jakebailey), the perf run you requested failed. You can check the log here. |
|
TypeScript Bot (@typescript-bot) perf test this faster |
|
Jake Bailey (@jakebailey), the perf run you requested failed. You can check the log here. |

No description provided.