Merge commit 'd029ddea8396d7a39910028dd5ae436a3bd3e9bb' as 'jubjub'

This commit is contained in:
Sean Bowe
2019-12-12 11:32:47 -07:00
34 changed files with 4035 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
#![feature(test)]
extern crate test;
use jubjub::*;
use test::Bencher;
// Non-Niels
#[bench]
fn bench_point_doubling(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
bencher.iter(move || a.double());
}
#[bench]
fn bench_point_addition(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = -ExtendedPoint::identity();
bencher.iter(move || a + b);
}
#[bench]
fn bench_point_subtraction(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = -ExtendedPoint::identity();
bencher.iter(move || a + b);
}
// Niels
#[bench]
fn bench_cached_point_addition(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = ExtendedPoint::identity().to_niels();
bencher.iter(move || &a + &b);
}
#[bench]
fn bench_cached_affine_point_subtraction(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = AffinePoint::identity().to_niels();
bencher.iter(move || &a + &b);
}
#[bench]
fn bench_cached_point_subtraction(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = ExtendedPoint::identity().to_niels();
bencher.iter(move || &a + &b);
}
#[bench]
fn bench_cached_affine_point_addition(bencher: &mut Bencher) {
let a = ExtendedPoint::identity();
let b = AffinePoint::identity().to_niels();
bencher.iter(move || &a + &b);
}