You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
770 B

  1. use criterion::{criterion_group, criterion_main, Criterion};
  2. extern crate ff;
  3. use ff::*;
  4. use poseidon_rs::{Fr, Poseidon};
  5. fn criterion_benchmark(c: &mut Criterion) {
  6. let b1: Fr = Fr::from_str(
  7. "12242166908188651009877250812424843524687801523336557272219921456462821518061",
  8. )
  9. .unwrap();
  10. let b2: Fr = Fr::from_str(
  11. "12242166908188651009877250812424843524687801523336557272219921456462821518061",
  12. )
  13. .unwrap();
  14. let mut big_arr: Vec<Fr> = Vec::new();
  15. big_arr.push(b1.clone());
  16. big_arr.push(b2.clone());
  17. let poseidon = Poseidon::new();
  18. c.bench_function("hash", |b| {
  19. b.iter(|| poseidon.hash(big_arr.clone()).unwrap())
  20. });
  21. }
  22. criterion_group!(benches, criterion_benchmark);
  23. criterion_main!(benches);