2021-01-13 13:24:47 +00:00
|
|
|
//! Benchmarks for hashing to the Pasta curves.
|
|
|
|
|
|
|
|
|
|
use criterion::{criterion_group, criterion_main, Criterion};
|
|
|
|
|
|
2021-03-03 21:46:11 +00:00
|
|
|
use pasta_curves::arithmetic::CurveExt;
|
2021-03-03 21:51:54 +00:00
|
|
|
use pasta_curves::{pallas, vesta};
|
2021-01-13 13:24:47 +00:00
|
|
|
|
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
|
|
|
bench_hash_to_curve(c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn bench_hash_to_curve(c: &mut Criterion) {
|
|
|
|
|
let mut group = c.benchmark_group("hash-to-curve");
|
|
|
|
|
|
2021-02-02 21:26:32 +00:00
|
|
|
let hash_pallas = pallas::Point::hash_to_curve("z.cash:test");
|
2021-01-13 13:24:47 +00:00
|
|
|
group.bench_function("Pallas", |b| b.iter(|| hash_pallas(b"benchmark")));
|
|
|
|
|
|
2021-02-02 21:26:32 +00:00
|
|
|
let hash_vesta = vesta::Point::hash_to_curve("z.cash:test");
|
2021-01-13 13:24:47 +00:00
|
|
|
group.bench_function("Vesta", |b| b.iter(|| hash_vesta(b"benchmark")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
|
|
|
criterion_main!(benches);
|