2021-01-13 05:24:47 -08:00
|
|
|
//! Benchmarks for hashing to the Pasta curves.
|
|
|
|
|
|
|
|
use criterion::{criterion_group, criterion_main, Criterion};
|
|
|
|
|
2022-01-20 10:28:44 -08:00
|
|
|
use halo2_proofs::arithmetic::CurveExt;
|
|
|
|
use halo2_proofs::pasta::{pallas, vesta};
|
2021-01-13 05:24:47 -08: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 13:26:32 -08:00
|
|
|
let hash_pallas = pallas::Point::hash_to_curve("z.cash:test");
|
2021-01-13 05:24:47 -08:00
|
|
|
group.bench_function("Pallas", |b| b.iter(|| hash_pallas(b"benchmark")));
|
|
|
|
|
2021-02-02 13:26:32 -08:00
|
|
|
let hash_vesta = vesta::Point::hash_to_curve("z.cash:test");
|
2021-01-13 05:24:47 -08:00
|
|
|
group.bench_function("Vesta", |b| b.iter(|| hash_vesta(b"benchmark")));
|
|
|
|
}
|
|
|
|
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
|
|
criterion_main!(benches);
|