mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-11-02 12:27:02 +00:00
Merge commit 'd029ddea8396d7a39910028dd5ae436a3bd3e9bb' as 'jubjub'
This commit is contained in:
58
jubjub/benches/point_bench.rs
Normal file
58
jubjub/benches/point_bench.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user