-
Notifications
You must be signed in to change notification settings - Fork 463
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
Better logic to simplify and/or. #7134
Conversation
Current logic for code generated by untagged unions pattern matching only focuses on certain cases of x == b where b is a boolean. There are more cases, and there are other constants than booleans: nil, undefined.
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05
.
Benchmark suite | Current: dfc207b | Previous: e1b7fb7 | Ratio |
---|---|---|---|
Print RedBlackTree.res - time/run |
2.42937178 ms |
2.3104395133333333 ms |
1.05 |
This comment was automatically generated by workflow using github-action-benchmark.
@cknitt this is ready for a first review. This already changes the way the logic is handled, and fixed a bug where a simplification was applied before, which was incorrect. |
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.
This is great! 😍
A minor thing to follow up with could be to simplify x === undefined || x === null
to x == null
, as they're equivalent. Would that fit into a similar mechanism?
Where is that generated? |
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.
Sorry, too late! This is awesome! 👍
Current logic for code generated by untagged unions pattern matching only focuses on certain cases of x == b where b is a boolean. There are more cases, and there are other constants than booleans: nil, undefined.