Skip to content

Commit

Permalink
tests(Benches): fixes failing bench marks
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Jan 28, 2016
1 parent b5836af commit 4b8b5b6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
39 changes: 39 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,42 @@ lints = ["clippy", "nightly"]
nightly = [] # for building with nightly and unstable features
unstable = ["lints", "nightly"] # for building with travis-cargo
debug = [] # for building with debug messages

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
# codegen-units ignored with lto=true

[profile.dev]
opt-level = 0
debug = true
rpath = false
lto = false
debug-assertions = true
codegen-units = 4

[profile.test]
opt-level = 1
debug = true
rpath = false
lto = false
debug-assertions = true
codegen-units = 2

[profile.bench]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false

[profile.doc]
opt-level = 0
debug = true
rpath = false
lto = false
debug-assertions = true
codegen-units = 4
12 changes: 6 additions & 6 deletions benches/03_complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use clap::{App, Arg, SubCommand};

use test::Bencher;

static M_VAL_NAMES: [&'static str; 2] = ["one", "two"];
static ARGS: &'static str = "-o --option=[opt]... 'tests options'
[positional] 'tests positionals'";
static OPT3_VALS: [&'static str; 2] = ["fast", "slow"];
Expand All @@ -29,8 +28,8 @@ macro_rules! create_app {
Arg::from_usage("[positional2] 'tests positionals with exclusions'"),
Arg::from_usage("-O --Option [option3] 'tests options with specific value sets'").possible_values(&OPT3_VALS),
Arg::from_usage("[positional3]... 'tests positionals with specific values'").possible_values(&POS3_VALS),
Arg::from_usage("--multvals [multvals] 'Tests mutliple values, not mult occs'").value_names(&M_VAL_NAMES),
Arg::from_usage("--multvalsmo [multvalsmo]... 'Tests mutliple values, not mult occs'").value_names(&M_VAL_NAMES),
Arg::from_usage("--multvals [one] [two] 'Tests mutliple values, not mult occs'"),
Arg::from_usage("--multvalsmo... [one] [two] 'Tests mutliple values, not mult occs'"),
Arg::from_usage("--minvals2 [minvals]... 'Tests 2 min vals'").min_values(2),
Arg::from_usage("--maxvals3 [maxvals]... 'Tests 3 max vals'").max_values(3)
])
Expand Down Expand Up @@ -100,13 +99,13 @@ fn create_app_builder(b: &mut Bencher) {
.long("multvals")
.takes_value(true)
.help("Tests mutliple values, not mult occs")
.value_names(&M_VAL_NAMES))
.value_names(&["one", "two"]))
.arg(Arg::with_name("multvalsmo")
.long("multvalsmo")
.takes_value(true)
.multiple(true)
.help("Tests mutliple values, not mult occs")
.value_names(&M_VAL_NAMES))
.value_names(&["one", "two"]))
.arg(Arg::with_name("minvals")
.long("minvals2")
.multiple(true)
Expand Down Expand Up @@ -135,7 +134,8 @@ fn create_app_builder(b: &mut Bencher) {
});
}

#[bench]
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "unstable", bench)]
fn create_app_macros(b: &mut Bencher) {
b.iter(|| {
clap_app!(claptests =>
Expand Down

0 comments on commit 4b8b5b6

Please sign in to comment.