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

test: benchmark feature toggle evaluation #138

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

nunogois
Copy link
Member

@nunogois nunogois commented Sep 1, 2023

After discussing with @gardleopard we were interested in a naïve and simple benchmark for feature toggle evaluation in a language like Go.

This can be ran with a command like: go test -run=^$ -bench=BenchmarkFeatureToggleEvaluation -benchtime=10s

Here's an example of how the output could look like:

❯ go test -run=^$ -bench=BenchmarkFeatureToggleEvaluation -benchtime=10s
goos: darwin
goarch: arm64
pkg: github.com/Unleash/unleash-client-go/v3
BenchmarkFeatureToggleEvaluation-8 Final Estimated Operations Per Day: 101.131 billion (1.011315e+11)
13635154 854.3 ns/op
PASS
ok github.com/Unleash/unleash-client-go/v3 13.388s

The -8 in BenchmarkFeatureToggleEvaluation-8 stands for 8 cores (all the cores in my M1 CPU).
Clarification: This version of the code is actually only using 1 core, no parallelism.

I couldn't find a way of initializing our Unleash client without a listener, so I added a simple NoOpListener.

Copy link

@gardleopard gardleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tested this together and I love it! Would be good to add the how to run this in the README.md as well.

@nunogois
Copy link
Member Author

nunogois commented Sep 1, 2023

We tested this together and I love it! Would be good to add the how to run this in the README.md as well.

Added a new mention to the benchmark in the README, let me know what you think. Addressed in b9dc624

@nunogois nunogois merged commit 88862d8 into v3 Sep 1, 2023
5 checks passed
@nunogois nunogois deleted the test-benchmark-toggle-evaluation branch September 1, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants