Allow pre-compilation of rules conditions#122
Merged
luispfgarces merged 36 commits intomasterfrom Apr 10, 2023
Merged
Conversation
…analysis logic to separate class
…conditions eval engine
…ditions_only_exact_match_modes
…ditions_only_exact_match_modes
…ditions_only_exact_match_modes
… memory data source
carlosgoias
previously approved these changes
Mar 20, 2023
Contributor
|
More of a nit-pick, but in the header of the Pull Request consider changing Classic to Interpreted. |
jdromeiro
requested changes
Mar 31, 2023
…ditions_only_exact_match_modes
carlosgoias
previously approved these changes
Apr 3, 2023
jdromeiro
requested changes
Apr 5, 2023
…ditions_only_exact_match_modes
jdromeiro
approved these changes
Apr 6, 2023
carlosgoias
approved these changes
Apr 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds functionality to pre-compile rules' conditions in order to speed up evaluation times. Putting it simply: it adds a middleware component that intercepts rules loaded from the data source or being written to the data source, and compiles them to a lambda expression. The resultant lambda expression is stored on the data source, thanks to the new
IConditionNode<TConditionType>.Propertiesdictionary property, which enables to store the compiled lambda expression. This compiled lambda expression is then loaded from the data source avoiding re-compiling the rules' conditions again. This development also includes a conditions eval engine prepared to evaluate compiled rules.A new project with a Benchmark.Net implementation was already added to measure some performance numbers. Unfortunately, I was unable to assess the improvement of this implementation vs. the
mastercodebase. I'm including the performance numbers taken from the implementation as-is for your consideration.Here's how they compare:
Related to #49.
Change checklist
Please also check the I want to contribute guidelines and make sure you have done accordingly.
Disclaimer
By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement