mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-09 21:58:06 -05:00
test: Inc. new_circom(1) constructed hash in bench
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user