Migrate from BigInt to ff::Fr, remove generic methods

Migrate from BigInt to ff::Fr, remove generic methods

On a Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz, with 32 GB of RAM:

- Old:
hash    time:   [927.61 us 927.78 us 927.98 us]

- New:
hash    time:   [26.495 us 26.503 us 26.512 us]
This commit is contained in:
arnaucube
2020-09-29 20:02:01 +02:00
parent cf52a51655
commit dcd31c27c6
4 changed files with 182 additions and 263 deletions

View File

@@ -1,21 +1,21 @@
use criterion::{criterion_group, criterion_main, Criterion};
use num_bigint::BigInt;
#[macro_use]
extern crate ff;
use ff::*;
use mimc_rs::Mimc7;
use mimc_rs::{Fr, Mimc7};
fn criterion_benchmark(c: &mut Criterion) {
let b1: BigInt = BigInt::parse_bytes(
b"12242166908188651009877250812424843524687801523336557272219921456462821518061",
10,
let b1: Fr = Fr::from_str(
"12242166908188651009877250812424843524687801523336557272219921456462821518061",
)
.unwrap();
let b2: BigInt = BigInt::parse_bytes(
b"12242166908188651009877250812424843524687801523336557272219921456462821518061",
10,
let b2: Fr = Fr::from_str(
"12242166908188651009877250812424843524687801523336557272219921456462821518061",
)
.unwrap();
let mut big_arr: Vec<BigInt> = Vec::new();
let mut big_arr: Vec<Fr> = Vec::new();
big_arr.push(b1.clone());
big_arr.push(b2.clone());
let mimc7 = Mimc7::new();