-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(benchmarks): Write better benchmark for testing the aggregator #3839
Conversation
relay-metrics/benches/benches.rs
Outdated
]; | ||
|
||
for input in &inputs { | ||
for (input_name, input) in &inputs { | ||
c.bench_with_input( |
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.
Can make a criterion group here and specify throughput, compare to here
relay/relay-cardinality/benches/redis_impl.rs
Line 198 in 4d5941a
g.throughput(criterion::Throughput::Elements(params.rounds as u64)); |
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.
Oh nice!
relay-metrics/benches/benches.rs
Outdated
}, | ||
|(mut aggregator, buckets)| { | ||
for (project_key, bucket) in buckets { | ||
aggregator.merge(project_key, bucket, None).unwrap(); | ||
#[allow(clippy::unit_arg)] | ||
black_box(aggregator.merge(project_key, bucket, None).unwrap()); |
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.
I think the black box should be on the aggregator after the loop.
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.
I thought that black_box
is handled specifically by the compiler just by wrapping an expression with it. Maybe I need to better read the docs.
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.
I read the docs, it's indeed doing some stuff with the result value, treating it pessimistically.
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.
The result value here is just the unit type. I am not sure what the compiler is allowed to optimize here, but for me it makes more sense on the "result".
This PR reworks the benchmarks for the aggregator by adding more fine-grained control over certain parameters.
Closes: #3844
#skip-changelog