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

perf: optimize handle_negation to check rules in reversed order #47

Conversation

ruancomelli
Copy link
Contributor

The utility function handle_negation can be optimized to return early if we iterate over rules in reversed order.

In the previous implementation, handle_negation always iterates over all rules to find for matches. However, since later rules take precedence, we can perform the search in reversed order and return early.

This pull request is a performance improvement and should not change behavior, as verified by the tests.

@mherrmann mherrmann merged commit e5e116d into mherrmann:master Aug 3, 2023
5 checks passed
@ruancomelli ruancomelli deleted the ruancomelli/optimize-handle-negation-to-check-reversed-rules branch August 4, 2023 13:04
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.

2 participants