Skip to content

Conversation

@tomgasson
Copy link

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 Java SDK: statsig-io/java-server-sdk#28

This reduces the number of hashing operations performed substantially
@tore-statsig
Copy link
Contributor

Nice catch, thanks for the pr! This shoudl have been merged in 7458d71

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