# HG changeset patch # User Tuomo Valkonen # Date 1669931169 -7200 # Node ID df971c81282e19f98547457b43c1236459688245 # Parent eb3c7813b67acf6b6b89c71acd0b24594b0fccd6 Warn when trying to run an unoptimised executable diff -r eb3c7813b67a -r df971c81282e src/main.rs --- a/src/main.rs Thu Dec 01 23:07:35 2022 +0200 +++ b/src/main.rs Thu Dec 01 23:46:09 2022 +0200 @@ -15,12 +15,13 @@ use clap::Parser; use itertools::Itertools; use serde_json; +use std::num::NonZeroUsize; + use alg_tools::iterate::Verbose; use alg_tools::parallelism::{ set_num_threads, set_max_threads, }; -use std::num::NonZeroUsize; pub mod types; pub mod measures; @@ -198,6 +199,18 @@ pub fn main() { let cli = CommandLineArgs::parse(); + #[cfg(debug_assertions)] + { + use colored::Colorize; + println!("{}", format!("\n\ + ********\n\ + WARNING: Compiled without optimisations; {}\n\ + Please recompile with `--release` flag.\n\ + ********\n\ + ", "performance will be poor!".blink() + ).red()); + } + if let Some(n_threads) = cli.num_threads { let n = NonZeroUsize::new(n_threads).expect("Invalid thread count"); set_num_threads(n);