-
Notifications
You must be signed in to change notification settings - Fork 12
bench: generate random inputs for each benchmark iteration #25
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
base: main
Are you sure you want to change the base?
Conversation
Previously benchmarks reused the same static data for all iterations, which could lead to unrealistic performance measurements due to cache effects and lack of input variation. Changes: - Add rand dependency for random data generation - Replace static data setup with iter_batched pattern - Generate fresh random inputs for each benchmark iteration - Update all 20+ benchmark functions to use random inputs - Remove unused helper functions This ensures more realistic and robust performance measurements by testing with varied inputs on each iteration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
CodSpeed Performance ReportMerging #25 will degrade performances by 98.5%Comparing Summary
Benchmarks breakdown
|
benches/bench.rs
Outdated
| b.iter(|| Nibbles::from_nibbles(black_box(data))) | ||
| group.bench_function(BenchmarkId::from_parameter(size), |b| { | ||
| b.iter_batched( | ||
| || generate_nibbles_random(size), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense but this will only work locally; codspeed only uses 1 input regardless of the function used. See ruint benchmarks for a wrapper to run multiple times on codspeed
df4a3bb to
9020723
Compare
1eb3f92 to
1a1cf4e
Compare
1a1cf4e to
3cfe0b4
Compare
080f9d7 to
081e9e9
Compare
29160ef to
c0ea65f
Compare
c0ea65f to
1d396d8
Compare
1d396d8 to
122ba17
Compare
ab8c5a8 to
6e61d1f
Compare
6e61d1f to
16c4dd2
Compare
6afa918 to
72a1ec9
Compare
72a1ec9 to
4c5bfa2
Compare
5acfa7e to
b7e8c75
Compare
5d98fce to
0c76a10
Compare
dddf790 to
776bc31
Compare
| #[inline] | ||
| fn manual_batch<T, U>(mut setup: impl FnMut() -> T, mut f: impl FnMut(&T) -> U) -> impl FnMut(T) { | ||
| let inputs = | ||
| criterion::black_box((0..CODSPEED_BATCH_SIZE).map(|_| setup()).collect::<Vec<_>>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std::hint::black_box
Previously benchmarks reused the same static data for all iterations, which could lead to unrealistic performance measurements due to cache effects and lack of input variation.
Now we use
proptest::arbitraryto generate random data.