common: rule preprocessing for performance#1114
Open
madumas wants to merge 3 commits intographprotocol:mainfrom
Open
common: rule preprocessing for performance#1114madumas wants to merge 3 commits intographprotocol:mainfrom
madumas wants to merge 3 commits intographprotocol:mainfrom
Conversation
Author
|
CI jobs appear to be failing due to permissions or because I'm outside the org |
dwerner
approved these changes
Jun 24, 2025
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.
This change significantly improves the performance of rule matching operations by implementing a Map-based lookup system. Previously, each deployment required a linear search through all rules, resulting in O(n*m) complexity for n deployments and m rules.
Key changes:
PreprocessedRulesinterface to maintain type safetyevaluateDeploymentsandmatchingRuleExiststo use the new lookup systemThis optimization is particularly impactful for large rule sets, reducing the complexity from O(n*m) to O(n) where n is the number of deployments. For example, with 800 rules and 15,000 deployments, the number of operations is reduced from approximately 12 million to 15,000.