Skip to content

Commit

Permalink
make benchmark more random
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Sep 27, 2024
1 parent ece3335 commit cd535b3
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions poseidon/benches/poseidon_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ pub fn bench_poseidon_kimchi(c: &mut Criterion) {
let mut poseidon =
Poseidon::<Fp, PlonkSpongeConstantsKimchi>::new(SpongeParametersKimchi::static_params());

// Chain of hashes, starting from a random value
group.bench_function("poseidon_hash_kimchi", |b| {
let mut hash: Fp = rand::random();

b.iter(|| {
let input: Vec<Fp> = vec![
Fp::from(1),
Fp::from(2),
Fp::from(3),
Fp::from(4),
Fp::from(5),
];
poseidon.absorb(&input);
poseidon.squeeze();
poseidon.absorb(&vec![hash]);
hash = poseidon.squeeze();
})
});

Expand Down

0 comments on commit cd535b3

Please sign in to comment.