diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-05-02 10:24:47 +0300 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-05-02 15:32:54 +0300 |
| commit | 1a2ad5528f7a61390c40c0b6f56fa507923d09f5 (patch) | |
| tree | 713b8e86674a34b3a6b6d65062709f192f5b894c /zkvms_host_io/src/lib.rs | |
| parent | eefb57f2c035be1a398f630dd8cfed8b4ccbe348 (diff) | |
| download | zkVMs-benchmarks-1a2ad5528f7a61390c40c0b6f56fa507923d09f5.tar zkVMs-benchmarks-1a2ad5528f7a61390c40c0b6f56fa507923d09f5.tar.gz zkVMs-benchmarks-1a2ad5528f7a61390c40c0b6f56fa507923d09f5.zip | |
chore: cargo fmt
Diffstat (limited to 'zkvms_host_io/src/lib.rs')
| -rw-r--r-- | zkvms_host_io/src/lib.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/zkvms_host_io/src/lib.rs b/zkvms_host_io/src/lib.rs index a3249a0..584a883 100644 --- a/zkvms_host_io/src/lib.rs +++ b/zkvms_host_io/src/lib.rs @@ -159,14 +159,15 @@ pub fn output_proof_size<T>(proof: &T) { } pub fn output_proof_size_raw(size: usize) { - std::fs::write(PROOF_SIZE_FILE_PATH, size.to_string()).expect(&format!("Couldn't write proof size to \"{PROOF_SIZE_FILE_PATH}\"!")); + std::fs::write(PROOF_SIZE_FILE_PATH, size.to_string()).expect(&format!( + "Couldn't write proof size to \"{PROOF_SIZE_FILE_PATH}\"!" + )); } fn mean(xs: &Vec<f32>) -> f32 { if xs.len() == 1 { xs[0] - } - else { + } else { statistical::mean(&xs) } } @@ -174,8 +175,7 @@ fn mean(xs: &Vec<f32>) -> f32 { fn stddev(xs: &Vec<f32>) -> f32 { if xs.len() == 1 { 0.0 - } - else { + } else { statistical::standard_deviation(&xs, None) } } @@ -199,8 +199,16 @@ pub fn emit_benchmark_results(run_info: RunWith, starts: Vec<Instant>, ends: Vec run["mean"] = mean(&durations).into(); run["deviation"] = stddev(&durations).into(); - run["min"] = (*durations.iter().min_by(|a,b| a.partial_cmp(b).unwrap()).unwrap()).into(); - run["max"] = (*durations.iter().max_by(|a,b| a.partial_cmp(b).unwrap()).unwrap()).into(); + run["min"] = (*durations + .iter() + .min_by(|a, b| a.partial_cmp(b).unwrap()) + .unwrap()) + .into(); + run["max"] = (*durations + .iter() + .max_by(|a, b| a.partial_cmp(b).unwrap()) + .unwrap()) + .into(); run["memory"] = Null; run["proofSize"] = Null; |
