shockwave-plus/shockwave_plus/benches/prove.rs
shockwave_plus/benches/prove.rsRaw
1#![allow(non_snake_case)]
2use criterion::{criterion_group, criterion_main, Criterion};
3use shockwave_plus::ShockwavePlus;
4use shockwave_plus::R1CS;
5use tensor_pcs::Transcript;
6
7fn shockwave_plus_bench(c: &mut Criterion) {
8 type F = halo2curves::secp256k1::Fp;
9
10 for exp in [12, 15, 18] {
11 let num_cons = 2usize.pow(exp);
12 let num_vars = num_cons;
13 let num_input = 0;
14
15 let (r1cs, witness) = R1CS::<F>::produce_synthetic_r1cs(num_cons, num_vars, num_input);
16
17 let mut group = c.benchmark_group(format!("ShockwavePlus num_cons: {}", num_cons));
18 let l = 319;
19 let num_rows = (((2f64 / l as f64).sqrt() * (num_vars as f64).sqrt()) as usize)
20 .next_power_of_two()
21 / 2;
22 let ShockwavePlus = ShockwavePlus::new(r1cs.clone(), l, num_rows);
23 group.bench_function("prove", |b| {
24 b.iter(|| {
25 let mut transcript = Transcript::new(b"bench");
26 ShockwavePlus.prove(&witness, &mut transcript);
27 })
28 });
29 }
30}
31
32fn set_duration() -> Criterion {
33 Criterion::default().sample_size(10)
34}
35
36criterion_group! {
37 name = benches;
38 config = set_duration();
39 targets = shockwave_plus_bench
40}
41criterion_main!(benches);