diff options
author | Aria Shrimpton <me@aria.rip> | 2024-01-23 12:56:52 +0000 |
---|---|---|
committer | Aria Shrimpton <me@aria.rip> | 2024-01-23 12:56:52 +0000 |
commit | 0a9b6cfa4aa85d9f4512c6a12564a4c1a87ba313 (patch) | |
tree | ef2cf8afbb8d041ecf9311dc04321d8c518efdb0 /src/crates | |
parent | 2ff1d75882fedf177b2e429a4b217aa4a11b9351 (diff) |
allow running benchmarks with estimate command
Diffstat (limited to 'src/crates')
-rw-r--r-- | src/crates/cli/src/estimate.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/crates/cli/src/estimate.rs b/src/crates/cli/src/estimate.rs index ad7df17..0365388 100644 --- a/src/crates/cli/src/estimate.rs +++ b/src/crates/cli/src/estimate.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use std::{collections::HashMap, iter::once}; use anyhow::{anyhow, bail, Result}; use argh::FromArgs; @@ -13,6 +13,10 @@ pub struct Args { /// the assignments, written <type name> <implementation> ... #[argh(positional, greedy)] assignments: Vec<String>, + + /// also run the benchmarks with this set of assignments + #[argh(switch)] + run: bool, } impl State { @@ -55,6 +59,17 @@ impl State { print_table(acc); + if !args.run { + return Ok(()); + } + + print_table( + self.inner + .run_benchmarks_with(proj, &assignments)? + .into_iter() + .map(|(name, results)| (name, once(("avg", results.avg)))), + ); + Ok(()) } } |