mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
test(bench): Switch to divan
This commit is contained in:
parent
7425ee74e8
commit
b0fea2bac6
11 changed files with 500 additions and 1036 deletions
174
Cargo.lock
generated
174
Cargo.lock
generated
|
@ -75,12 +75,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anes"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||
|
||||
[[package]]
|
||||
name = "ansi-str"
|
||||
version = "0.8.0"
|
||||
|
@ -310,12 +304,6 @@ dependencies = [
|
|||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
|
@ -398,33 +386,6 @@ dependencies = [
|
|||
"phf_codegen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"ciborium-ll",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-io"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-ll"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"half",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.6.1"
|
||||
|
@ -464,7 +425,7 @@ name = "clap_bench"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"clap 4.4.18",
|
||||
"criterion",
|
||||
"divan",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
|
@ -633,6 +594,12 @@ dependencies = [
|
|||
"vt100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "condtype"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf0a07a401f374238ab8e2f11a104d2851bf9ce711ec69804834de8af45c7af"
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.7"
|
||||
|
@ -709,42 +676,6 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
|
||||
dependencies = [
|
||||
"anes",
|
||||
"cast",
|
||||
"ciborium",
|
||||
"clap 4.4.17",
|
||||
"criterion-plot",
|
||||
"is-terminal",
|
||||
"itertools 0.10.5",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"oorandom",
|
||||
"plotters",
|
||||
"rayon",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tinytemplate",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion-plot"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
|
||||
dependencies = [
|
||||
"cast",
|
||||
"itertools 0.10.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.6"
|
||||
|
@ -894,6 +825,31 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "divan"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5398159ee27f2b123d89b856bad61725442f37df5fb98c30cd570c318d594aee"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"clap 4.4.17",
|
||||
"condtype",
|
||||
"divan-macros",
|
||||
"libc",
|
||||
"regex-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "divan-macros"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5092f66eb3563a01e85552731ae82c04c934ff4efd7ad1a0deae7b948f4b3ec4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtparse"
|
||||
version = "2.0.0"
|
||||
|
@ -1147,12 +1103,6 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
||||
|
||||
[[package]]
|
||||
name = "hamcrest2"
|
||||
version = "0.3.0"
|
||||
|
@ -2273,12 +2223,6 @@ version = "1.18.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
version = "11.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "5.0.0"
|
||||
|
@ -2517,34 +2461,6 @@ version = "0.3.27"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "plotters"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"plotters-backend",
|
||||
"plotters-svg",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plotters-backend"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142"
|
||||
|
||||
[[package]]
|
||||
name = "plotters-svg"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f"
|
||||
dependencies = [
|
||||
"plotters-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pori"
|
||||
version = "0.0.0"
|
||||
|
@ -2802,6 +2718,12 @@ dependencies = [
|
|||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-lite"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.2"
|
||||
|
@ -3375,16 +3297,6 @@ dependencies = [
|
|||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
|
@ -3925,16 +3837,6 @@ dependencies = [
|
|||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.0"
|
||||
|
|
|
@ -13,35 +13,25 @@ release = false
|
|||
|
||||
[dev-dependencies]
|
||||
clap = { path = "../", version = "4.0.0", default-features = false, features = ["std", "help"] }
|
||||
criterion = "0.5.1"
|
||||
divan = "0.1.11"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "01_default"
|
||||
path = "benches/01_default.rs"
|
||||
name = "empty"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "02_simple"
|
||||
path = "benches/02_simple.rs"
|
||||
name = "simple"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "03_complex"
|
||||
path = "benches/03_complex.rs"
|
||||
name = "complex"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "04_new_help"
|
||||
path = "benches/04_new_help.rs"
|
||||
name = "rustup"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "05_ripgrep"
|
||||
path = "benches/05_ripgrep.rs"
|
||||
|
||||
[[bench]]
|
||||
harness = false
|
||||
name = "06_rustup"
|
||||
path = "benches/06_rustup.rs"
|
||||
name = "ripgrep"
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
use clap::Command;
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
|
||||
pub fn build_empty(c: &mut Criterion) {
|
||||
c.bench_function("build_empty", |b| b.iter(|| Command::new("claptests")));
|
||||
}
|
||||
|
||||
pub fn parse_empty(c: &mut Criterion) {
|
||||
c.bench_function("parse_empty", |b| {
|
||||
b.iter(|| Command::new("claptests").get_matches_from(vec![""]))
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, build_empty, parse_empty);
|
||||
criterion_main!(benches);
|
|
@ -1,104 +0,0 @@
|
|||
use clap::{arg, Arg, Command};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
Command::new("claptests")
|
||||
.version("0.1")
|
||||
.about("tests clap library")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-f --flag "tests flags"))
|
||||
.arg(arg!(-o --option <opt> "tests options"))
|
||||
.arg(arg!([positional] "tests positional"))
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn build_simple(c: &mut Criterion) {
|
||||
c.bench_function("build_simple", |b| b.iter(|| create_app!()));
|
||||
}
|
||||
|
||||
pub fn build_with_flag(c: &mut Criterion) {
|
||||
c.bench_function("build_with_flag", |b| {
|
||||
b.iter(|| Command::new("claptests").arg(arg!(-s --some "something")))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build_with_flag_ref(c: &mut Criterion) {
|
||||
c.bench_function("build_with_flag_ref", |b| {
|
||||
b.iter(|| {
|
||||
let arg = arg!(-s --some "something");
|
||||
Command::new("claptests").arg(&arg)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build_with_opt(c: &mut Criterion) {
|
||||
c.bench_function("build_with_opt", |b| {
|
||||
b.iter(|| Command::new("claptests").arg(arg!(-s --some <FILE> "something").required(true)))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build_with_opt_ref(c: &mut Criterion) {
|
||||
c.bench_function("build_with_opt_ref", |b| {
|
||||
b.iter(|| {
|
||||
let arg = arg!(-s --some <FILE> "something").required(true);
|
||||
Command::new("claptests").arg(&arg)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build_with_pos(c: &mut Criterion) {
|
||||
c.bench_function("build_with_pos", |b| {
|
||||
b.iter(|| Command::new("claptests").arg(Arg::new("some")))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build_with_pos_ref(c: &mut Criterion) {
|
||||
c.bench_function("build_with_pos_ref", |b| {
|
||||
b.iter(|| {
|
||||
let arg = Arg::new("some");
|
||||
Command::new("claptests").arg(&arg)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_simple_with_flag(c: &mut Criterion) {
|
||||
c.bench_function("parse_simple_with_flag", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-f"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_simple_with_opt(c: &mut Criterion) {
|
||||
c.bench_function("parse_simple_with_opt", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-o", "option1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_simple_with_pos(c: &mut Criterion) {
|
||||
c.bench_function("parse_simple_with_pos", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "arg1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_simple_with_complex(c: &mut Criterion) {
|
||||
c.bench_function("parse_simple_with_complex", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-o", "option1", "-f", "arg1"]))
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
parse_simple_with_complex,
|
||||
parse_simple_with_pos,
|
||||
parse_simple_with_opt,
|
||||
parse_simple_with_flag,
|
||||
build_with_pos_ref,
|
||||
build_with_pos,
|
||||
build_with_opt_ref,
|
||||
build_with_opt,
|
||||
build_with_flag_ref,
|
||||
build_with_flag,
|
||||
build_simple
|
||||
);
|
||||
|
||||
criterion_main!(benches);
|
|
@ -1,296 +0,0 @@
|
|||
use clap::{arg, Arg, ArgAction, Command};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
|
||||
static OPT3_VALS: [&str; 2] = ["fast", "slow"];
|
||||
static POS3_VALS: [&str; 2] = ["vi", "emacs"];
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
Command::new("claptests")
|
||||
.version("0.1")
|
||||
.about("tests clap library")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-o --option <opt> ... "tests options"))
|
||||
.arg(arg!([positional] "tests positionals"))
|
||||
.arg(arg!(-f --flag ... "tests flags").global(true))
|
||||
.args([
|
||||
arg!(flag2: -F "tests flags with exclusions")
|
||||
.conflicts_with("flag")
|
||||
.requires("option2"),
|
||||
arg!(option2: --"long-option-2" <option2> "tests long options with exclusions")
|
||||
.conflicts_with("option")
|
||||
.requires("positional2"),
|
||||
arg!([positional2] "tests positionals with exclusions"),
|
||||
arg!(-O --Option <option3> "tests options with specific value sets")
|
||||
.value_parser(OPT3_VALS),
|
||||
arg!([positional3] ... "tests positionals with specific values")
|
||||
.value_parser(POS3_VALS),
|
||||
arg!(--multvals <s> "Tests multiple values not mult occs").value_names(["one", "two"]),
|
||||
arg!(
|
||||
--multvalsmo <s> "Tests multiple values, not mult occs"
|
||||
).required(false).value_names(["one", "two"]),
|
||||
arg!(--minvals2 <minvals> ... "Tests 2 min vals").num_args(2..),
|
||||
arg!(--maxvals3 <maxvals> ... "Tests 3 max vals").num_args(1..=3),
|
||||
])
|
||||
.subcommand(
|
||||
Command::new("subcmd")
|
||||
.about("tests subcommands")
|
||||
.version("0.1")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-o --option <scoption> ... "tests options"))
|
||||
.arg(arg!([scpositional] "tests positionals"))
|
||||
)
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn build_from_builder(c: &mut Criterion) {
|
||||
c.bench_function("build_from_builder", |b| {
|
||||
b.iter(|| {
|
||||
Command::new("claptests")
|
||||
.version("0.1")
|
||||
.about("tests clap library")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(
|
||||
Arg::new("opt")
|
||||
.help("tests options")
|
||||
.short('o')
|
||||
.long("option")
|
||||
.num_args(1..)
|
||||
.action(ArgAction::Append),
|
||||
)
|
||||
.arg(Arg::new("positional").help("tests positionals").index(1))
|
||||
.arg(
|
||||
Arg::new("flag")
|
||||
.short('f')
|
||||
.help("tests flags")
|
||||
.long("flag")
|
||||
.global(true)
|
||||
.action(ArgAction::Count),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("flag2")
|
||||
.short('F')
|
||||
.help("tests flags with exclusions")
|
||||
.action(ArgAction::SetTrue)
|
||||
.conflicts_with("flag")
|
||||
.requires("option2"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("option2")
|
||||
.help("tests long options with exclusions")
|
||||
.conflicts_with("option")
|
||||
.requires("positional2")
|
||||
.action(ArgAction::Set)
|
||||
.long("long-option-2"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("positional2")
|
||||
.index(3)
|
||||
.help("tests positionals with exclusions"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("option3")
|
||||
.short('O')
|
||||
.long("Option")
|
||||
.action(ArgAction::Set)
|
||||
.help("tests options with specific value sets")
|
||||
.value_parser(OPT3_VALS),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("positional3")
|
||||
.num_args(1..)
|
||||
.help("tests positionals with specific values")
|
||||
.index(4)
|
||||
.value_parser(POS3_VALS),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("multvals")
|
||||
.long("multvals")
|
||||
.help("Tests multiple values, not mult occs")
|
||||
.value_names(["one", "two"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("multvalsmo")
|
||||
.long("multvalsmo")
|
||||
.action(ArgAction::Append)
|
||||
.help("Tests multiple values, not mult occs")
|
||||
.value_names(["one", "two"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("minvals")
|
||||
.long("minvals2")
|
||||
.action(ArgAction::Append)
|
||||
.help("Tests 2 min vals")
|
||||
.num_args(2..),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("maxvals")
|
||||
.long("maxvals3")
|
||||
.action(ArgAction::Append)
|
||||
.help("Tests 3 max vals")
|
||||
.num_args(1..=3),
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("subcmd")
|
||||
.about("tests subcommands")
|
||||
.version("0.1")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(
|
||||
Arg::new("scoption")
|
||||
.short('o')
|
||||
.long("option")
|
||||
.num_args(1..)
|
||||
.action(ArgAction::Append)
|
||||
.help("tests options"),
|
||||
)
|
||||
.arg(Arg::new("scpositional").index(1).help("tests positionals")),
|
||||
)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec![""]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_flag(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_flag", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-f"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_opt(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_opt", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-o", "option1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_pos(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_pos", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "arg1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_sc(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_sc", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "subcmd"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_sc_flag(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_sc_flag", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "subcmd", "-f"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_sc_opt(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_sc_opt", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "subcmd", "-o", "option1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_sc_pos(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_sc_pos", |b| {
|
||||
b.iter(|| create_app!().get_matches_from(vec!["myprog", "subcmd", "arg1"]))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex1(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex1", |b| {
|
||||
b.iter(|| {
|
||||
create_app!().get_matches_from(vec![
|
||||
"myprog",
|
||||
"-ff",
|
||||
"-o",
|
||||
"option1",
|
||||
"arg1",
|
||||
"-O",
|
||||
"fast",
|
||||
"arg2",
|
||||
"--multvals",
|
||||
"one",
|
||||
"two",
|
||||
"emacs",
|
||||
])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex2(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex2", |b| {
|
||||
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",
|
||||
])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_args_negate_scs(c: &mut Criterion) {
|
||||
c.bench_function("parse_args_negate_scs", |b| {
|
||||
b.iter(|| {
|
||||
create_app!()
|
||||
.args_conflicts_with_subcommands(true)
|
||||
.get_matches_from(vec![
|
||||
"myprog",
|
||||
"arg1",
|
||||
"-f",
|
||||
"arg2",
|
||||
"--long-option-2",
|
||||
"some",
|
||||
"-O",
|
||||
"slow",
|
||||
"--multvalsmo",
|
||||
"one",
|
||||
"two",
|
||||
"--minvals2",
|
||||
"3",
|
||||
"2",
|
||||
"1",
|
||||
])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_complex_with_sc_complex(c: &mut Criterion) {
|
||||
c.bench_function("parse_complex_with_sc_complex", |b| {
|
||||
b.iter(|| {
|
||||
create_app!().get_matches_from(vec!["myprog", "subcmd", "-f", "-o", "option1", "arg1"])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
build_from_builder,
|
||||
parse_complex,
|
||||
parse_complex_with_flag,
|
||||
parse_complex_with_opt,
|
||||
parse_complex_with_pos,
|
||||
parse_complex_with_sc,
|
||||
parse_complex_with_sc_flag,
|
||||
parse_complex_with_sc_opt,
|
||||
parse_complex_with_sc_pos,
|
||||
parse_complex1,
|
||||
parse_complex2,
|
||||
parse_args_negate_scs,
|
||||
parse_complex_with_sc_complex
|
||||
);
|
||||
|
||||
criterion_main!(benches);
|
|
@ -1,220 +0,0 @@
|
|||
use clap::Command;
|
||||
use clap::{arg, Arg, ArgAction};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
|
||||
fn build_help(cmd: &mut Command) -> String {
|
||||
let help = cmd.render_help();
|
||||
help.to_string()
|
||||
}
|
||||
|
||||
fn app_example1() -> Command {
|
||||
Command::new("MyApp")
|
||||
.version("1.0")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.about("Does awesome things")
|
||||
.arg(
|
||||
arg!(
|
||||
-c --config <FILE> "Sets a custom config file"
|
||||
)
|
||||
.required(false),
|
||||
)
|
||||
.arg(arg!(<output> "Sets an optional output file"))
|
||||
.arg(arg!(d: -d ... "Turn debugging information on"))
|
||||
.subcommand(
|
||||
Command::new("test")
|
||||
.about("does testing things")
|
||||
.arg(arg!(-l --list "lists test values")),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example2() -> Command {
|
||||
Command::new("MyApp")
|
||||
.version("1.0")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.about("Does awesome things")
|
||||
}
|
||||
|
||||
fn app_example3() -> Command {
|
||||
Command::new("MyApp")
|
||||
.arg(
|
||||
Arg::new("debug")
|
||||
.help("turn on debugging information")
|
||||
.short('d')
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.args([
|
||||
Arg::new("config")
|
||||
.help("sets the config file to use")
|
||||
.action(ArgAction::Set)
|
||||
.short('c')
|
||||
.long("config"),
|
||||
Arg::new("input")
|
||||
.help("the input file to use")
|
||||
.required(true),
|
||||
])
|
||||
.arg(arg!(--license "display the license file"))
|
||||
.arg(arg!([output] "Supply an output file to use"))
|
||||
.arg(
|
||||
arg!(
|
||||
-i --int <IFACE> "Set an interface to use"
|
||||
)
|
||||
.required(false),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example4() -> Command {
|
||||
Command::new("MyApp")
|
||||
.about("Parses an input file to do awesome things")
|
||||
.version("1.0")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(
|
||||
Arg::new("debug")
|
||||
.help("turn on debugging information")
|
||||
.short('d')
|
||||
.action(ArgAction::SetTrue)
|
||||
.long("debug"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("config")
|
||||
.help("sets the config file to use")
|
||||
.short('c')
|
||||
.long("config"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("input")
|
||||
.help("the input file to use")
|
||||
.index(1)
|
||||
.required(true),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example5() -> Command {
|
||||
Command::new("MyApp").arg(
|
||||
Arg::new("awesome")
|
||||
.help("turns up the awesome")
|
||||
.short('a')
|
||||
.long("awesome")
|
||||
.action(ArgAction::Count),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example6() -> Command {
|
||||
Command::new("MyApp")
|
||||
.arg(
|
||||
Arg::new("input")
|
||||
.help("the input file to use")
|
||||
.index(1)
|
||||
.requires("config")
|
||||
.required(true),
|
||||
)
|
||||
.arg(Arg::new("config").help("the config file to use").index(2))
|
||||
}
|
||||
|
||||
fn app_example7() -> Command {
|
||||
Command::new("MyApp")
|
||||
.arg(Arg::new("config"))
|
||||
.arg(Arg::new("output"))
|
||||
.arg(
|
||||
Arg::new("input")
|
||||
.help("the input file to use")
|
||||
.num_args(1..)
|
||||
.action(ArgAction::Append)
|
||||
.required(true)
|
||||
.short('i')
|
||||
.long("input")
|
||||
.requires("config")
|
||||
.conflicts_with("output"),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example8() -> Command {
|
||||
Command::new("MyApp")
|
||||
.arg(Arg::new("config"))
|
||||
.arg(Arg::new("output"))
|
||||
.arg(
|
||||
Arg::new("input")
|
||||
.help("the input file to use")
|
||||
.num_args(1..)
|
||||
.action(ArgAction::Append)
|
||||
.required(true)
|
||||
.short('i')
|
||||
.long("input")
|
||||
.requires("config")
|
||||
.conflicts_with("output"),
|
||||
)
|
||||
}
|
||||
|
||||
fn app_example10() -> Command {
|
||||
Command::new("myapp").about("does awesome things").arg(
|
||||
Arg::new("CONFIG")
|
||||
.help("The config file to use (default is \"config.json\")")
|
||||
.short('c')
|
||||
.action(ArgAction::Set),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn example1(c: &mut Criterion) {
|
||||
let mut cmd = app_example1();
|
||||
c.bench_function("example1", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example2(c: &mut Criterion) {
|
||||
let mut cmd = app_example2();
|
||||
c.bench_function("example2", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example3(c: &mut Criterion) {
|
||||
let mut cmd = app_example3();
|
||||
c.bench_function("example3", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example4(c: &mut Criterion) {
|
||||
let mut cmd = app_example4();
|
||||
c.bench_function("example4", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example5(c: &mut Criterion) {
|
||||
let mut cmd = app_example5();
|
||||
c.bench_function("example5", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example6(c: &mut Criterion) {
|
||||
let mut cmd = app_example6();
|
||||
c.bench_function("example6", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example7(c: &mut Criterion) {
|
||||
let mut cmd = app_example7();
|
||||
c.bench_function("example7", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example8(c: &mut Criterion) {
|
||||
let mut cmd = app_example8();
|
||||
c.bench_function("example8", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example10(c: &mut Criterion) {
|
||||
let mut cmd = app_example10();
|
||||
c.bench_function("example10", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
pub fn example4_template(c: &mut Criterion) {
|
||||
let mut cmd = app_example4().help_template("{name} {version}\n{author}\n{about}\n\nUSAGE:\n {usage}\n\nOPTIONS:\n{options}\n\nARGS:\n{args}\n");
|
||||
c.bench_function("example4_template", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
example1,
|
||||
example2,
|
||||
example3,
|
||||
example4,
|
||||
example5,
|
||||
example6,
|
||||
example7,
|
||||
example8,
|
||||
example10,
|
||||
example4_template
|
||||
);
|
||||
|
||||
criterion_main!(benches);
|
136
clap_bench/benches/complex.rs
Normal file
136
clap_bench/benches/complex.rs
Normal file
|
@ -0,0 +1,136 @@
|
|||
use clap::{arg, ArgMatches, Command};
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
Command::new("claptests")
|
||||
.version("0.1")
|
||||
.about("tests clap library")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-o --option <opt> ... "tests options"))
|
||||
.arg(arg!([positional] "tests positionals"))
|
||||
.arg(arg!(-f --flag ... "tests flags").global(true))
|
||||
.args([
|
||||
arg!(flag2: -F "tests flags with exclusions")
|
||||
.conflicts_with("flag")
|
||||
.requires("option2"),
|
||||
arg!(option2: --"long-option-2" <option2> "tests long options with exclusions")
|
||||
.conflicts_with("option")
|
||||
.requires("positional2"),
|
||||
arg!([positional2] "tests positionals with exclusions"),
|
||||
arg!(-O --Option <option3> "tests options with specific value sets")
|
||||
.value_parser(["fast", "slow"]),
|
||||
arg!([positional3] ... "tests positionals with specific values")
|
||||
.value_parser(["vi", "emacs"]),
|
||||
arg!(--multvals <s> "Tests multiple values not mult occs").value_names(["one", "two"]),
|
||||
arg!(
|
||||
--multvalsmo <s> "Tests multiple values, not mult occs"
|
||||
).required(false).value_names(["one", "two"]),
|
||||
arg!(--minvals2 <minvals> ... "Tests 2 min vals").num_args(2..),
|
||||
arg!(--maxvals3 <maxvals> ... "Tests 3 max vals").num_args(1..=3),
|
||||
])
|
||||
.subcommand(
|
||||
Command::new("subcmd")
|
||||
.about("tests subcommands")
|
||||
.version("0.1")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-o --option <scoption> ... "tests options"))
|
||||
.arg(arg!([scpositional] "tests positionals"))
|
||||
)
|
||||
}};
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn build() -> Command {
|
||||
create_app!()
|
||||
}
|
||||
|
||||
#[divan::bench(args=COMPLEX_ARGS)]
|
||||
fn startup(args: &Args) -> ArgMatches {
|
||||
create_app!().get_matches_from(args.args())
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn render_help(bencher: divan::Bencher) {
|
||||
let mut cmd = create_app!();
|
||||
bencher.bench_local(|| build_help(&mut cmd));
|
||||
}
|
||||
|
||||
fn build_help(cmd: &mut Command) -> String {
|
||||
let help = cmd.render_help();
|
||||
help.to_string()
|
||||
}
|
||||
|
||||
const COMPLEX_ARGS: &[Args] = &[
|
||||
Args("empty", &[""]),
|
||||
Args("flag", &["myprog", "-f"]),
|
||||
Args("opt", &["myprog", "-o", "option1"]),
|
||||
Args("pos", &["myprog", "arg1"]),
|
||||
Args("sc", &["myprog", "subcmd"]),
|
||||
Args("sc_flag", &["myprog", "subcmd", "-f"]),
|
||||
Args("sc_opt", &["myprog", "subcmd", "-o", "option1"]),
|
||||
Args("sc_pos", &["myprog", "subcmd", "arg1"]),
|
||||
Args(
|
||||
"sc_nested",
|
||||
&["myprog", "subcmd", "-f", "-o", "option1", "arg1"],
|
||||
),
|
||||
Args(
|
||||
"mixed1",
|
||||
&[
|
||||
"myprog",
|
||||
"-ff",
|
||||
"-o",
|
||||
"option1",
|
||||
"arg1",
|
||||
"-O",
|
||||
"fast",
|
||||
"arg2",
|
||||
"--multvals",
|
||||
"one",
|
||||
"two",
|
||||
"emacs",
|
||||
],
|
||||
),
|
||||
Args(
|
||||
"mixed2",
|
||||
&[
|
||||
"myprog",
|
||||
"arg1",
|
||||
"-f",
|
||||
"arg2",
|
||||
"--long-option-2",
|
||||
"some",
|
||||
"-O",
|
||||
"slow",
|
||||
"--multvalsmo",
|
||||
"one",
|
||||
"two",
|
||||
"--minvals2",
|
||||
"3",
|
||||
"2",
|
||||
"1",
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Args(&'static str, &'static [&'static str]);
|
||||
|
||||
impl Args {
|
||||
pub const fn name(&self) -> &'static str {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub const fn args(&self) -> &[&str] {
|
||||
self.1
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Args {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.name().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
33
clap_bench/benches/empty.rs
Normal file
33
clap_bench/benches/empty.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use clap::ArgMatches;
|
||||
use clap::Command;
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
Command::new("claptests")
|
||||
}};
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn build() -> Command {
|
||||
create_app!()
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn startup() -> ArgMatches {
|
||||
create_app!().get_matches_from(vec![""])
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn render_help(bencher: divan::Bencher) {
|
||||
let mut cmd = create_app!();
|
||||
bencher.bench_local(|| build_help(&mut cmd));
|
||||
}
|
||||
|
||||
fn build_help(cmd: &mut Command) -> String {
|
||||
let help = cmd.render_help();
|
||||
help.to_string()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
|
@ -3,239 +3,231 @@
|
|||
//
|
||||
// CLI used is adapted from ripgrep 48a8a3a691220f9e5b2b08f4051abe8655ea7e8a
|
||||
|
||||
use clap::{value_parser, Arg, ArgAction, Command};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use clap::{value_parser, Arg, ArgAction, ArgMatches, Command};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
pub fn build_rg_with_short_help(c: &mut Criterion) {
|
||||
c.bench_function("build_rg_with_short_help", |b| b.iter(app_short));
|
||||
mod build {
|
||||
use super::*;
|
||||
|
||||
#[divan::bench]
|
||||
fn short_help() -> Command {
|
||||
app_short()
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn long_help() -> Command {
|
||||
app_long()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_rg_with_long_help(c: &mut Criterion) {
|
||||
c.bench_function("build_rg_with_long_help", |b| b.iter(app_long));
|
||||
mod render_help {
|
||||
use super::*;
|
||||
|
||||
#[divan::bench]
|
||||
fn short_help(bencher: divan::Bencher) {
|
||||
let mut cmd = app_short();
|
||||
bencher.bench_local(|| build_help(&mut cmd));
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn long_help(bencher: divan::Bencher) {
|
||||
let mut cmd = app_long();
|
||||
bencher.bench_local(|| build_help(&mut cmd));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_rg_short_help(c: &mut Criterion) {
|
||||
let mut cmd = app_short();
|
||||
c.bench_function("write_rg_short_help", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
mod startup {
|
||||
use super::*;
|
||||
|
||||
pub fn write_rg_long_help(c: &mut Criterion) {
|
||||
let mut cmd = app_long();
|
||||
c.bench_function("write_rg_long_help", |b| b.iter(|| build_help(&mut cmd)));
|
||||
}
|
||||
#[divan::bench]
|
||||
fn simple() -> ArgMatches {
|
||||
app_short().get_matches_from(vec!["rg", "pat"])
|
||||
}
|
||||
|
||||
pub fn parse_rg(c: &mut Criterion) {
|
||||
c.bench_function("parse_rg", |b| {
|
||||
b.iter(|| app_short().get_matches_from(vec!["rg", "pat"]))
|
||||
});
|
||||
}
|
||||
#[divan::bench]
|
||||
fn complex() -> ArgMatches {
|
||||
app_short().get_matches_from(vec![
|
||||
"rg",
|
||||
"pat",
|
||||
"-cFlN",
|
||||
"-pqr=some",
|
||||
"--null",
|
||||
"--no-filename",
|
||||
"--no-messages",
|
||||
"-SH",
|
||||
"-C5",
|
||||
"--follow",
|
||||
"-e some",
|
||||
])
|
||||
}
|
||||
|
||||
pub fn parse_rg_with_complex(c: &mut Criterion) {
|
||||
c.bench_function("parse_rg_with_complex", |b| {
|
||||
b.iter(|| {
|
||||
app_short().get_matches_from(vec![
|
||||
"rg",
|
||||
"pat",
|
||||
"-cFlN",
|
||||
"-pqr=some",
|
||||
"--null",
|
||||
"--no-filename",
|
||||
"--no-messages",
|
||||
"-SH",
|
||||
"-C5",
|
||||
"--follow",
|
||||
"-e some",
|
||||
])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn parse_rg_with_lots(c: &mut Criterion) {
|
||||
c.bench_function("parse_rg_with_lots", |b| {
|
||||
b.iter(|| {
|
||||
app_short().get_matches_from(vec![
|
||||
"rg", "pat", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some",
|
||||
])
|
||||
})
|
||||
});
|
||||
#[divan::bench]
|
||||
fn xargs() -> ArgMatches {
|
||||
app_short().get_matches_from(vec![
|
||||
"rg", "pat", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some", "some", "some", "some", "some",
|
||||
"some", "some", "some", "some", "some", "some", "some",
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
const ABOUT: &str = "
|
||||
|
@ -929,14 +921,6 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
build_rg_with_short_help,
|
||||
build_rg_with_long_help,
|
||||
write_rg_short_help,
|
||||
write_rg_long_help,
|
||||
parse_rg,
|
||||
parse_rg_with_complex,
|
||||
parse_rg_with_lots
|
||||
);
|
||||
criterion_main!(benches);
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
|
@ -2,23 +2,25 @@
|
|||
//
|
||||
// CLI used is from rustup 408ed84f0e50511ed44a405dd91365e5da588790
|
||||
|
||||
use clap::{Arg, ArgAction, ArgGroup, Command};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use clap::{Arg, ArgAction, ArgGroup, ArgMatches, Command};
|
||||
|
||||
pub fn build_rustup(c: &mut Criterion) {
|
||||
c.bench_function("build_rustup", |b| b.iter(build_cli));
|
||||
#[divan::bench]
|
||||
fn build() -> Command {
|
||||
build_cli()
|
||||
}
|
||||
|
||||
pub fn parse_rustup(c: &mut Criterion) {
|
||||
c.bench_function("parse_rustup", |b| {
|
||||
b.iter(|| build_cli().get_matches_from(vec![""]))
|
||||
});
|
||||
}
|
||||
mod startup {
|
||||
use super::*;
|
||||
|
||||
pub fn parse_rustup_with_sc(c: &mut Criterion) {
|
||||
c.bench_function("parse_rustup_with_sc", |b| {
|
||||
b.iter(|| build_cli().get_matches_from(vec!["rustup override add stable"]))
|
||||
});
|
||||
#[divan::bench]
|
||||
fn empty() -> ArgMatches {
|
||||
build_cli().get_matches_from([""])
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn sc() -> ArgMatches {
|
||||
build_cli().get_matches_from(["rustup override add stable"])
|
||||
}
|
||||
}
|
||||
|
||||
fn build_cli() -> Command {
|
||||
|
@ -435,6 +437,6 @@ default browser.
|
|||
By default, it opens the documentation index. Use the various flags to
|
||||
open specific pieces of documentation.";
|
||||
|
||||
criterion_group!(benches, build_rustup, parse_rustup, parse_rustup_with_sc);
|
||||
|
||||
criterion_main!(benches);
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
52
clap_bench/benches/simple.rs
Normal file
52
clap_bench/benches/simple.rs
Normal file
|
@ -0,0 +1,52 @@
|
|||
use clap::{arg, ArgMatches, Command};
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
Command::new("claptests")
|
||||
.version("0.1")
|
||||
.about("tests clap library")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.arg(arg!(-f --flag "tests flags"))
|
||||
.arg(arg!(-o --option <opt> "tests options"))
|
||||
.arg(arg!([positional] "tests positional"))
|
||||
}};
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn build() -> Command {
|
||||
create_app!()
|
||||
}
|
||||
|
||||
mod startup {
|
||||
use super::*;
|
||||
|
||||
#[divan::bench]
|
||||
fn flag() -> ArgMatches {
|
||||
create_app!().get_matches_from(vec!["myprog", "-f"])
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn opt() -> ArgMatches {
|
||||
create_app!().get_matches_from(vec!["myprog", "-o", "option1"])
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn pos() -> ArgMatches {
|
||||
create_app!().get_matches_from(vec!["myprog", "arg1"])
|
||||
}
|
||||
}
|
||||
|
||||
#[divan::bench]
|
||||
fn render_help(bencher: divan::Bencher) {
|
||||
let mut cmd = create_app!();
|
||||
bencher.bench_local(|| build_help(&mut cmd));
|
||||
}
|
||||
|
||||
fn build_help(cmd: &mut Command) -> String {
|
||||
let help = cmd.render_help();
|
||||
help.to_string()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
Loading…
Reference in a new issue