Skip to content
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

Merged
merged 6 commits into from
Oct 31, 2024
Merged

Better logic to simplify and/or. #7134

merged 6 commits into from
Oct 31, 2024

Conversation

cristianoc
Copy link
Collaborator

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.

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.
Copy link

@github-actions github-actions bot left a 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.

@cristianoc cristianoc requested a review from cknitt October 30, 2024 18:28
@cristianoc
Copy link
Collaborator Author

@cknitt this is ready for a first review.
Will do more, but it can be continued in a separate PR.

This already changes the way the logic is handled, and fixed a bug where a simplification was applied before, which was incorrect.

@cristianoc cristianoc requested a review from zth October 31, 2024 08:06
Copy link
Collaborator

@zth zth left a 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?

@cristianoc
Copy link
Collaborator Author

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?

@cristianoc cristianoc merged commit 795becf into master Oct 31, 2024
20 checks passed
@cristianoc cristianoc deleted the better_and_or_code_gen branch October 31, 2024 10:23
Copy link
Member

@cknitt cknitt left a 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! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants