feat(flag-evaluation): optimize ANY_OF and NOT_ANY_OFF operators#413
Merged
feat(flag-evaluation): optimize ANY_OF and NOT_ANY_OFF operators#413
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the evaluation of ANY_OF and NOT_ANY_OF operators by pre-processing rule filters to use sets for faster lookups.
- Introduces a newEvaluator function that converts list values to sets for the ANY_OF and NOT_ANY_OF operators.
- Adds corresponding tests in index.test.ts to verify the optimized evaluation logic.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/flag-evaluation/test/index.test.ts | Added tests to validate the behavior of optimized rule evaluations with newEvaluator. |
| packages/flag-evaluation/src/index.ts | Implemented a newEvaluator function and integrated set-based lookups for specific operators. |
pavkam
approved these changes
May 22, 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.
Expose a new evaluation interface which lets us optimize the ANY_OF and NOT_ANY_OFF operators. This works through the use of a one-time pre-evaluation step which converts lists used in ANY_OF and NOT_ANY_OFF evaluation to sets for quicker lookups.