1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

factor::benches::table: Match BenchmarkId w/ criterion's conventions

See https://bheisler.github.io/criterion.rs/book/user_guide/comparing_functions.html
This commit is contained in:
nicoo 2021-05-08 17:56:18 +02:00
parent 7c649bc74e
commit 1cd001f529

View file

@ -28,10 +28,7 @@ fn table(c: &mut Criterion) {
group.throughput(Throughput::Elements(INPUT_SIZE as _)); group.throughput(Throughput::Elements(INPUT_SIZE as _));
for a in inputs.take(10) { for a in inputs.take(10) {
let a_str = format!("{:?}", a); let a_str = format!("{:?}", a);
group.bench_with_input( group.bench_with_input(BenchmarkId::new("factor_chunk", &a_str), &a, |b, &a| {
BenchmarkId::from_parameter("chunked_".to_owned() + &a_str),
&a,
|b, &a| {
b.iter(|| { b.iter(|| {
let mut n_s = a.clone(); let mut n_s = a.clone();
let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one());
@ -39,12 +36,8 @@ fn table(c: &mut Criterion) {
factor_chunk(n_s.try_into().unwrap(), f_s.try_into().unwrap()) factor_chunk(n_s.try_into().unwrap(), f_s.try_into().unwrap())
} }
}) })
}, });
); group.bench_with_input(BenchmarkId::new("factor", &a_str), &a, |b, &a| {
group.bench_with_input(
BenchmarkId::from_parameter("seq_".to_owned() + &a_str),
&a,
|b, &a| {
b.iter(|| { b.iter(|| {
let mut n_s = a.clone(); let mut n_s = a.clone();
let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one());
@ -52,8 +45,7 @@ fn table(c: &mut Criterion) {
factor(n, f) factor(n, f)
} }
}) })
}, });
);
} }
group.finish() group.finish()
} }