Skip to content

Commit

Permalink
refactor: substitute batched SNARK for non-preprocecssing SNARK
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Feb 23, 2024
1 parent e0b72a0 commit 2020d73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 545 deletions.
35 changes: 2 additions & 33 deletions benches/compressed-snark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ cfg_if::cfg_if! {
criterion_group! {
name = compressed_snark;
config = Criterion::default().warm_up_time(Duration::from_millis(3000)).with_profiler(pprof::criterion::PProfProfiler::new(100, pprof::criterion::Output::Flamegraph(None)));
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark, bench_compressed_batched_snark_with_computational_commitments
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark_with_computational_commitments
}
} else {
criterion_group! {
name = compressed_snark;
config = Criterion::default().warm_up_time(Duration::from_millis(3000));
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark, bench_compressed_batched_snark_with_computational_commitments
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark_with_computational_commitments
}
}
}
Expand Down Expand Up @@ -188,41 +188,10 @@ fn bench_compressed_snark_with_computational_commitments(c: &mut Criterion) {
}
}

// SNARKs without computation commitmnets
type BS1 = arecibo::spartan::batched::BatchedRelaxedR1CSSNARK<E1, EE1>;
type BS2 = arecibo::spartan::batched::BatchedRelaxedR1CSSNARK<E2, EE2>;
// SNARKs with computation commitmnets
type BSS1 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E1, EE1>;
type BSS2 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E2, EE2>;

fn bench_compressed_batched_snark(c: &mut Criterion) {
// we vary the number of constraints in the step circuit
for &num_cons_in_augmented_circuit in [
NUM_CONS_VERIFIER_CIRCUIT_PRIMARY,
16384,
32768,
65536,
131072,
262144,
524288,
1048576,
]
.iter()
{
// number of constraints in the step circuit
let num_cons = num_cons_in_augmented_circuit - NUM_CONS_VERIFIER_CIRCUIT_PRIMARY;

let mut group = c.benchmark_group("BatchedCompressedSNARK");
group.sampling_mode(SamplingMode::Flat);
group.sample_size(NUM_SAMPLES);
group.noise_threshold(noise_threshold_env().unwrap_or(0.05));

bench_compressed_snark_internal::<BS1, BS2>(&mut group, num_cons);

group.finish();
}
}

fn bench_compressed_batched_snark_with_computational_commitments(c: &mut Criterion) {
// we vary the number of constraints in the step circuit
for &num_cons_in_augmented_circuit in [
Expand Down
Loading

0 comments on commit 2020d73

Please sign in to comment.