mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-11 08:31:29 +01:00
enabling batch opening and mock tests (#80)
- add mock circuits - add vanilla and jellyfish plonk gates - performance tuning
This commit is contained in:
37
arithmetic/benches/bench.rs
Normal file
37
arithmetic/benches/bench.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
#[macro_use]
|
||||
extern crate criterion;
|
||||
|
||||
use arithmetic::fix_variables;
|
||||
use ark_bls12_381::Fr;
|
||||
use ark_ff::Field;
|
||||
use ark_poly::{DenseMultilinearExtension, MultilinearExtension};
|
||||
use ark_std::{ops::Range, test_rng};
|
||||
use criterion::{black_box, BenchmarkId, Criterion};
|
||||
|
||||
const NUM_VARIABLES_RANGE: Range<usize> = 10..21;
|
||||
|
||||
fn evaluation_op_bench<F: Field>(c: &mut Criterion) {
|
||||
let mut rng = test_rng();
|
||||
let mut group = c.benchmark_group("Evaluate");
|
||||
for nv in NUM_VARIABLES_RANGE {
|
||||
group.bench_with_input(BenchmarkId::new("evaluate native", nv), &nv, |b, &nv| {
|
||||
let poly = DenseMultilinearExtension::<F>::rand(nv, &mut rng);
|
||||
let point: Vec<_> = (0..nv).map(|_| F::rand(&mut rng)).collect();
|
||||
b.iter(|| black_box(poly.evaluate(&point).unwrap()))
|
||||
});
|
||||
|
||||
group.bench_with_input(BenchmarkId::new("evaluate optimized", nv), &nv, |b, &nv| {
|
||||
let poly = DenseMultilinearExtension::<F>::rand(nv, &mut rng);
|
||||
let point: Vec<_> = (0..nv).map(|_| F::rand(&mut rng)).collect();
|
||||
b.iter(|| black_box(fix_variables(&poly, &point)))
|
||||
});
|
||||
}
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn bench_bls_381(c: &mut Criterion) {
|
||||
evaluation_op_bench::<Fr>(c);
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_bls_381);
|
||||
criterion_main!(benches);
|
||||
Reference in New Issue
Block a user