Skip to content

Commit 978646f

Browse files
committed
Fix Benchmark Pathing (nexus-xyz#547)
* Fix benchmark pathing. * Formatting. * Another path fix.
1 parent 39295ed commit 978646f

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

benchmarks/benches/integration_bench.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use test::Bencher;
1313
fn test_benchmark_fib_simple() {
1414
let results_file = get_timestamped_filename("benchmark_results");
1515
run_benchmark::<u32>(
16-
"../examples/src/fib",
16+
"../examples/src/bin/fib",
1717
"-C opt-level=3",
1818
EmulatorType::TwoPass,
1919
Vec::new(),
@@ -31,7 +31,7 @@ fn test_benchmark_fib_powers() {
3131
for input in inputs {
3232
let public_input_bytes = to_allocvec(&input).unwrap();
3333
run_benchmark::<u32>(
34-
"../examples/src/fib_input",
34+
"../examples/src/bin/fib_input",
3535
"-C opt-level=3",
3636
EmulatorType::TwoPass,
3737
public_input_bytes,
@@ -50,7 +50,7 @@ fn test_benchmark_keccak_powers() {
5050
for input in inputs {
5151
let public_input_bytes = to_allocvec(&input).unwrap();
5252
run_benchmark::<u32>(
53-
"../examples/src/keccak_input",
53+
"../examples/src/bin/keccak_input",
5454
"-C opt-level=3",
5555
EmulatorType::TwoPass,
5656
public_input_bytes,
@@ -66,7 +66,7 @@ fn bench_harvard_fib1000(b: &mut Bencher) {
6666
let results_file = get_timestamped_filename("benchmark_results");
6767
b.iter(|| {
6868
run_benchmark::<u32>(
69-
"../../examples/src/fib1000",
69+
"../examples/src/bin/fib1000",
7070
"-C opt-level=3",
7171
EmulatorType::Harvard,
7272
Vec::new(),
@@ -82,7 +82,7 @@ fn bench_linear_fib1000(b: &mut Bencher) {
8282
let results_file = get_timestamped_filename("benchmark_results");
8383
b.iter(|| {
8484
run_benchmark::<u32>(
85-
"../../examples/src/fib1000",
85+
"../examples/src/bin/fib1000",
8686
"-C opt-level=3",
8787
EmulatorType::default_linear(),
8888
Vec::new(),
@@ -98,7 +98,7 @@ fn bench_twopass_fib1000(b: &mut Bencher) {
9898
let results_file = get_timestamped_filename("benchmark_results");
9999
b.iter(|| {
100100
run_benchmark::<u32>(
101-
"../../examples/src/fib1000",
101+
"../examples/src/bin/fib1000",
102102
"-C opt-level=3",
103103
EmulatorType::TwoPass,
104104
Vec::new(),
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ fn public_input_native() -> Result<u32, String> {
5050
use std::io::{self, BufRead};
5151
let stdin = io::stdin();
5252
let mut lines = stdin.lock().lines();
53-
54-
let line = lines.next()
53+
54+
let line = lines
55+
.next()
5556
.ok_or("No input provided")?
5657
.map_err(|e| format!("Failed to read line: {}", e))?;
57-
58-
line.trim().parse()
58+
59+
line.trim()
60+
.parse()
5961
.map_err(|e| format!("Failed to parse input as u32: {}", e))
6062
}
6163

6264
#[nexus_rt::main]
6365
#[cfg_attr(target_arch = "riscv32", nexus_rt::public_input(x))]
64-
#[cfg_attr(not(target_arch = "riscv32"), nexus_rt::custom_input(x,public_input_native))]
66+
#[cfg_attr(
67+
not(target_arch = "riscv32"),
68+
nexus_rt::custom_input(x, public_input_native)
69+
)]
6570
fn main(x: u32) {
6671
let b = fib_iter(x);
6772

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,23 @@ fn public_input_native() -> Result<u32, String> {
157157
use std::io::{self, BufRead};
158158
let stdin = io::stdin();
159159
let mut lines = stdin.lock().lines();
160-
161-
let line = lines.next()
160+
161+
let line = lines
162+
.next()
162163
.ok_or("No input provided")?
163164
.map_err(|e| format!("Failed to read line: {}", e))?;
164-
165-
line.trim().parse()
165+
166+
line.trim()
167+
.parse()
166168
.map_err(|e| format!("Failed to parse input as u32: {}", e))
167169
}
168170

169171
#[nexus_rt::main]
170172
#[cfg_attr(target_arch = "riscv32", nexus_rt::public_input(x))]
171-
#[cfg_attr(not(target_arch = "riscv32"), nexus_rt::custom_input(x,public_input_native))]
173+
#[cfg_attr(
174+
not(target_arch = "riscv32"),
175+
nexus_rt::custom_input(x, public_input_native)
176+
)]
172177
fn main(x: u32) {
173178
let mut input: &[u8] = b"Hello, World!";
174179
let mut result: Vec<u8> = Vec::new();

0 commit comments

Comments
 (0)