-
Notifications
You must be signed in to change notification settings - Fork 38
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
Optimize code by using De Morgan laws #670
Conversation
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.
Thanks Einar! Unfortunately it is not improving the current KERNEL code (most likely because this would only possibly apply to the hash precompiles, where we already improved the binary ops combinations), but good to have nonetheless for the future!
I've left a light comment inline to expand the covering further
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.
Thanks Einar, just a couple nits, but LGTM!
Would also need to pull latest develop
for CI to run properly.
@@ -157,6 +159,65 @@ fn remove_ignored_values(code: &mut Vec<Item>) { | |||
}); | |||
} | |||
|
|||
/// Helper predicate for the De Morgan rules. | |||
fn is_push_or_dup(op: &Item) -> bool { |
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.
nit: we could use this new helper above in remove_ignored_values
, but the pattern matching may be clearer, so non-blocking.
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.
Done.
It is not worse, but I don't know if it is better.
9c6751d
to
aec0771
Compare
No description provided.