Upgrade to test-templates from algebra (#40)

* Upgrade to test-templates from algebra

* Fix Cargo.toml

* Fix search and replace

* Update

* Fix cargo tomls
This commit is contained in:
Pratyush Mishra
2021-01-31 11:47:41 -08:00
committed by GitHub
parent cd88721883
commit 487f0043d8
62 changed files with 72 additions and 1212 deletions

View File

@@ -42,6 +42,24 @@ macro_rules! ec_bench {
});
}
fn double(b: &mut $crate::bencher::Bencher) {
const SAMPLES: usize = 1000;
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let v: Vec<$projective> = (0..SAMPLES)
.map(|_| <$projective>::rand(&mut rng))
.collect();
let mut count = 0;
b.iter(|| {
let mut tmp = v[count];
n_fold!(tmp, double_in_place);
count = (count + 1) % SAMPLES;
tmp
});
}
fn add_assign_mixed(b: &mut $crate::bencher::Bencher) {
const SAMPLES: usize = 1000;
@@ -65,24 +83,6 @@ macro_rules! ec_bench {
});
}
fn double(b: &mut $crate::bencher::Bencher) {
const SAMPLES: usize = 1000;
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let v: Vec<($projective, $projective)> = (0..SAMPLES)
.map(|_| (<$projective>::rand(&mut rng), <$projective>::rand(&mut rng)))
.collect();
let mut count = 0;
b.iter(|| {
let mut tmp = v[count].0;
n_fold!(tmp, double_in_place);
count = (count + 1) % SAMPLES;
tmp
});
}
fn deser(b: &mut $crate::bencher::Bencher) {
use ark_ec::ProjectiveCurve;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
@@ -200,6 +200,7 @@ macro_rules! ec_bench {
mul_assign,
add_assign,
add_assign_mixed,
double,
ser,
deser,
ser_unchecked,