bench: adds a bench with short circuiting some calls via ArgsNegateSubcommands

This commit is contained in:
Kevin K 2017-01-02 14:38:17 -05:00
parent aa26a50d5c
commit 9c3cb9834c
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -4,7 +4,7 @@
extern crate clap;
extern crate test;
use clap::{App, Arg, SubCommand};
use clap::{App, Arg, SubCommand, AppSettings};
use test::Bencher;
@ -219,6 +219,10 @@ fn parse_complex2(b: &mut Bencher) {
b.iter(|| create_app!().get_matches_from(vec!["myprog", "arg1", "-f", "arg2", "--long-option-2", "some", "-O", "slow", "--multvalsmo", "one", "two", "--minvals2", "3", "2", "1"]));
}
#[bench]
fn parse_complex2_with_args_negate_scs(b: &mut Bencher) {
b.iter(|| create_app!().setting(AppSettings::ArgsNegateSubcommands).get_matches_from(vec!["myprog", "arg1", "-f", "arg2", "--long-option-2", "some", "-O", "slow", "--multvalsmo", "one", "two", "--minvals2", "3", "2", "1"]));
}
#[bench]
fn parse_sc_complex(b: &mut Bencher) {