-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Optimize match(true)
#18423
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: master
Are you sure you want to change the base?
Optimize match(true)
#18423
Conversation
65be600
to
aace896
Compare
This optimization is already happening in the compiler for explicit `===` expressions, but not for `match()`, which also compiles to `IS_IDENTICAL`.
aace896
to
d14138a
Compare
Of note: The optimizer is cautious with top-level code. Moving the entire code to a function gives:
That said, the optimizations are still lacking when Details
I wonder if this is better implemented as a DFA and SCCP pass. Namely, |
I'm not sure if I follow. Is the code snippet from master or this branch? For me, my PR also successfully optimizes:
Both the cast, as well as the |
I was referring to the behavior before your patch. |
do we expect this patch to improve performance? if so, how much? |
Quick test on my MacBook:
|
Resolves #18411