test: Inc. new_circom(1) constructed hash in bench

This commit is contained in:
Ben-PH
2025-05-06 15:22:54 +02:00
parent 96bc791047
commit 9bb8246b6a

View File

@@ -39,6 +39,7 @@ pub fn poseidon_benchmark(c: &mut Criterion) {
mds,
} = hasher.select_params(&[Fr::from(1)]).unwrap();
// group.measurement_time(std::time::Duration::from_secs(30));
for size in [10u32, 100, 1000].iter() {
group.throughput(Throughput::Elements(*size as u64));
@@ -89,6 +90,27 @@ pub fn poseidon_benchmark(c: &mut Criterion) {
)
},
);
group.bench_with_input(
BenchmarkId::new("Array hash light_circom", size),
size,
|b, &size| {
b.iter_batched(
// setup
|| {
let light_hasher_circom =
light_poseidon::Poseidon::<Fr>::new_circom(1).unwrap();
(light_hasher_circom, make_values(size))
},
// Actual benchmark
|(mut light_hasher_circom, values)| {
for v in values.iter() {
let _ = light_hasher_circom.hash(black_box(&v[..]));
}
},
BatchSize::SmallInput,
)
},
);
}
// Benchmark single hash operation separately