criterion.rs
criterion.rs copied to clipboard
Is there a guide for migrating from `0.2.*` to `0.4.*`?
I have some benchmarks (on 0.2.11
) that I'm trying to upgrade to use the latest Criterion (0.4.0
). A lot of them use the methods that were deprecated, like bench
, ParameterizedBenchmark
, etc. Since I didn't write these originally, I'm working my way through figuring out how to migrate them.
I see that the Getting Started Guide has an FAQ for migration, but all it says is
"All of these types and functions have been superseded by the BenchmarkGroup type, which is cleaner to use as well as more powerful and flexible."
But it doesn't seem to indicate how to change existing code to use the new type, and I didn't find anything like that when searching, either.
E.G., I have existing code like this (I've changed the names of the real functions):
c.bench(
"Compare Parallel vs Serial Massflip (10 cols)",
ParameterizedBenchmark::new(
"serial",
|b, &n_rows| {
b.iter_batched(
|| setup(n_rows, 10),
|input| {
let ixs = black_box(code_under_bench_serial_version(
&input,
));
assert_eq!(ixs.len(), n_rows);
},
BatchSize::LargeInput,
)
},
vec![100, 500, 1000, 5000, 10_000, 50_000],
)
.with_function("parallel", |b, &n_rows| {
b.iter_batched(
|| setup(n_rows, 10),
|input| {
let ixs = black_box(code_under_bench_parallel_version(
&input,
));
assert_eq!(ixs.len(), n_rows);
},
BatchSize::LargeInput,
)
}),
);
My questions are:
- Is there a guide somewhere as to how to migrate existing code?
- If not, would you be interested in me writing up the things I learn and submitting them as a PR? (My main concern here is that I might not try to cover all the deprecated methods)