Skip to content

Commit

Permalink
make benchmark prove_halt an actual criterion benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Jul 5, 2023
1 parent 4207029 commit 12f87de
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions triton-vm/benches/prove_halt.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use criterion::criterion_group;
use criterion::criterion_main;
use criterion::BenchmarkId;
use criterion::Criterion;
use twenty_first::util_types::algebraic_hasher::AlgebraicHasher;

use triton_opcodes::program::Program;
use triton_profiler::prof_start;
use triton_profiler::prof_stop;
use triton_profiler::triton_profiler::Report;
use triton_profiler::triton_profiler::TritonProfiler;
use twenty_first::util_types::algebraic_hasher::AlgebraicHasher;

use triton_vm::proof::Claim;
use triton_vm::shared_tests::save_proof;
use triton_vm::stark::Stark;
Expand All @@ -16,7 +17,7 @@ use triton_vm::stark::StarkParameters;
use triton_vm::vm::simulate;

/// cargo criterion --bench prove_halt
fn prove_halt(_criterion: &mut Criterion) {
fn prove_halt(criterion: &mut Criterion) {
let mut maybe_profiler = Some(TritonProfiler::new("Prove Halt"));
let mut report: Report = Report::placeholder();

Expand Down Expand Up @@ -55,6 +56,16 @@ fn prove_halt(_criterion: &mut Criterion) {
);
};

let bench_id = BenchmarkId::new("ProveHalt", 0);
let mut group = criterion.benchmark_group("prove_halt");
group.sample_size(10);
group.bench_function(bench_id, |bencher| {
bencher.iter(|| {
let _ = Stark::prove(&parameters, &claim, &aet, &mut None);
});
});
group.finish();

// save proof
let filename = "halt.tsp";
if let Err(e) = save_proof(filename, proof) {
Expand Down

0 comments on commit 12f87de

Please sign in to comment.