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.

27 lines
742 B

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