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

Shortcut hash computation for constant rules #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomgasson
Copy link

@tomgasson tomgasson commented Sep 3, 2024

I noticed that this implementation is always computing the per-rule hash. Most targetting cases are either including or excluding all users which pass the condition.

Shortcutting these always pass / always fail cases will substantially reduce the number of string concatenation and hashing operations performed in this hot loop of rule evaluation.

Some other clients already have this optimisation:
https://github.com/statsig-io/js-client-monorepo/blob/main/packages/js-on-device-eval-client/src/Evaluator.ts#L427-L433

PR to do the same to the node-js-server-sdk statsig-io/node-js-server-sdk#51

This reduces the number of hashing operations performed substantially
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.

1 participant