Skip to content

Commit

Permalink
fix: avoid magic constant in benches (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker authored Aug 9, 2023
1 parent 37a37ac commit 4335fbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions benches/end2end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use pasta_curves::pallas;
use std::sync::Arc;
use std::time::Duration;

const PUBLIC_PARAMS_PATH: &str = "/var/tmp/lurk_benches/public_params";
const DEFAULT_REDUCTION_COUNT: usize = 10;

fn go_base<F: LurkField>(store: &mut Store<F>, a: u64, b: u64) -> Ptr<F> {
Expand Down Expand Up @@ -66,7 +67,7 @@ fn end2end_benchmark(c: &mut Criterion) {
let pp = public_parameters::public_params(
reduction_count,
lang_pallas_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();

Expand Down Expand Up @@ -275,7 +276,7 @@ fn prove_benchmark(c: &mut Criterion) {
let pp = public_parameters::public_params(
reduction_count,
lang_pallas_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();
let frames = prover
Expand Down Expand Up @@ -319,7 +320,7 @@ fn prove_compressed_benchmark(c: &mut Criterion) {
let pp = public_parameters::public_params(
reduction_count,
lang_pallas_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();
let frames = prover
Expand Down Expand Up @@ -362,7 +363,7 @@ fn verify_benchmark(c: &mut Criterion) {
let pp = public_parameters::public_params(
reduction_count,
lang_pallas_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();
let frames = prover
Expand Down Expand Up @@ -411,7 +412,7 @@ fn verify_compressed_benchmark(c: &mut Criterion) {
let pp = public_parameters::public_params(
reduction_count,
lang_pallas_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();
let frames = prover
Expand Down
5 changes: 3 additions & 2 deletions benches/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use lurk::{
store::Store,
};

const PUBLIC_PARAMS_PATH: &str = "/var/tmp/lurk_benches/public_params";
const DEFAULT_REDUCTION_COUNT: usize = 100;
fn fib<F: LurkField>(store: &mut Store<F>, a: u64) -> Ptr<F> {
let program = format!(
Expand Down Expand Up @@ -52,7 +53,7 @@ fn fibo_total<M: measurement::Measurement>(name: &str, iterations: u64, c: &mut
let pp = public_params(
reduction_count,
lang_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();

Expand Down Expand Up @@ -108,7 +109,7 @@ fn fibo_prove<M: measurement::Measurement>(name: &str, iterations: u64, c: &mut
let pp = public_params(
reduction_count,
lang_rc.clone(),
Utf8Path::new("/var/tmp/lurk_benches/public_params"),
Utf8Path::new(PUBLIC_PARAMS_PATH),
)
.unwrap();

Expand Down

0 comments on commit 4335fbb

Please sign in to comment.