2024-05-04 19:59:40 +00:00
|
|
|
#![allow(elided_lifetimes_in_paths)] // needed for divan
|
|
|
|
|
2024-02-08 12:04:16 +00:00
|
|
|
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();
|
|
|
|
}
|