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

Enhancement: Reduce noise by running benchmarks multiple times in multiple subprocesses #262

Open
itamarst opened this issue Jul 10, 2024 · 0 comments

Comments

@itamarst
Copy link

Python has a built-in source of noise: the hash seed is randomized. Noise is bad because you can't e.g. tell if a 3% slowdown is noise, or due to a code change. How to get rid of noise?:

Setting a fixed value (export PYTHONHASHSEED=123) for the hash seed can give distorted results: maybe your tweaked code is faster with a particular fixed seed, but slower with other seeds. It also doesn't help with other sources of randomness.

The other approach is to run the benchmarks multiple times in multiple processes, to get a variety of seeds, and then use the combined results to report speed. This allows averaging out the impact of different random seeds, and results in less noise. This is ideally something the pytest-benchmark framework would do, so it can aggregate different benchmarks' results into one final result.

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

No branches or pull requests

1 participant