mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-09 07:21:30 +01:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user