arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
Add benchmark for sub_assign (#41)

Dev Ojha ValarDragon@users.noreply.github.com
Thu, 04 Feb 2021 15:50:08 -0600
commit

684969909b6ac473a48ccc9ba5ddf90c8daeee4e

parent

487f0043d83122582b90412160fa01ebab450b0a

1 files changed, 19 insertions(+), 0 deletions(-)

jump to
M curve-benches/src/macros/ec.rs → curve-benches/src/macros/ec.rs

@@ -42,6 +42,24 @@ tmp

}); } + fn sub_assign(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, v, sub_assign, count); + count = (count + 1) % SAMPLES; + tmp + }); + } + fn double(b: &mut $crate::bencher::Bencher) { const SAMPLES: usize = 1000;

@@ -199,6 +217,7 @@ group_ops,

rand, mul_assign, add_assign, + sub_assign, add_assign_mixed, double, ser,