diff --git a/ci/bench-runner/src/main.rs b/ci/bench-runner/src/main.rs index 3ca69cbc09..b71960d0c0 100644 --- a/ci/bench-runner/src/main.rs +++ b/ci/bench-runner/src/main.rs @@ -48,10 +48,12 @@ fn main() { } else { let all_regressed_benches = do_all_benches(optional_args.nr_repeat_benchmarks); - println!( - "The following benchmarks have shown a regression {:?} times: {:?}", - optional_args.nr_repeat_benchmarks, all_regressed_benches - ); + if !all_regressed_benches.is_empty() { + println!( + "The following benchmarks have shown a regression {:?} times: {:?}", + optional_args.nr_repeat_benchmarks, all_regressed_benches + ); + } } } else { eprintln!( diff --git a/cli/cli_utils/src/bench_utils.rs b/cli/cli_utils/src/bench_utils.rs index e382243a5c..146f500380 100644 --- a/cli/cli_utils/src/bench_utils.rs +++ b/cli/cli_utils/src/bench_utils.rs @@ -1,6 +1,6 @@ use crate::helpers::{example_file, run_cmd, run_roc}; use criterion::{black_box, measurement::Measurement, BenchmarkGroup}; -use rlimit::{Resource, setrlimit}; +use rlimit::{setrlimit, Resource}; use std::path::Path; fn exec_bench_w_input( @@ -35,17 +35,17 @@ fn check_cmd_output( executable_filename: &str, expected_ending: &str, ) { - let cmd_str = file.with_file_name(executable_filename).to_str().unwrap().to_string(); + let cmd_str = file + .with_file_name(executable_filename) + .to_str() + .unwrap() + .to_string(); if cmd_str.contains("cfold") { increase_stack_limit(); } - let out = run_cmd( - &cmd_str, - &[stdin_str], - &[], - ); + let out = run_cmd(&cmd_str, &[stdin_str], &[]); if !&out.stdout.ends_with(expected_ending) { panic!( @@ -62,21 +62,19 @@ fn bench_cmd( executable_filename: &str, bench_group_opt: Option<&mut BenchmarkGroup>, ) { - let cmd_str = file.with_file_name(executable_filename).to_str().unwrap().to_string(); - + let cmd_str = file + .with_file_name(executable_filename) + .to_str() + .unwrap() + .to_string(); + if cmd_str.contains("cfold") { increase_stack_limit(); } if let Some(bench_group) = bench_group_opt { bench_group.bench_function(&format!("Benchmarking {:?}", executable_filename), |b| { - b.iter(|| { - run_cmd( - black_box(&cmd_str), - black_box(&[stdin_str]), - &[], - ) - }) + b.iter(|| run_cmd(black_box(&cmd_str), black_box(&[stdin_str]), &[])) }); } else { run_cmd( @@ -88,8 +86,9 @@ fn bench_cmd( } fn increase_stack_limit() { - let new_stack_limit = 8192*100000; - setrlimit(Resource::STACK, new_stack_limit, new_stack_limit).expect("Failed to increase stack limit."); + let new_stack_limit = 8192 * 100000; + setrlimit(Resource::STACK, new_stack_limit, new_stack_limit) + .expect("Failed to increase stack limit."); } pub fn bench_nqueens(bench_group_opt: Option<&mut BenchmarkGroup>) {