From 865583a464d05a0055d6557fd27c2593af300c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Tue, 8 Aug 2023 20:57:10 -0400 Subject: [PATCH] fix: avoid magic constant in benches --- benches/end2end.rs | 11 ++++++----- benches/fibonacci.rs | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/benches/end2end.rs b/benches/end2end.rs index 4b85a4a903..60423c9a62 100644 --- a/benches/end2end.rs +++ b/benches/end2end.rs @@ -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(store: &mut Store, a: u64, b: u64) -> Ptr { @@ -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(); @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/benches/fibonacci.rs b/benches/fibonacci.rs index a9f6392ea0..dfb6808ad7 100644 --- a/benches/fibonacci.rs +++ b/benches/fibonacci.rs @@ -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(store: &mut Store, a: u64) -> Ptr { let program = format!( @@ -52,7 +53,7 @@ fn fibo_total(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(); @@ -108,7 +109,7 @@ fn fibo_prove(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();