clap/clap_bench/benches/01_default.rs

16 lines
447 B
Rust
Raw Normal View History

2022-02-12 03:48:29 +00:00
use clap::Command;
2020-02-17 18:14:19 +00:00
use criterion::{criterion_group, criterion_main, Criterion};
2015-09-01 16:00:51 +00:00
2020-03-05 09:06:17 +00:00
pub fn build_empty(c: &mut Criterion) {
2022-02-12 03:48:29 +00:00
c.bench_function("build_empty", |b| b.iter(|| Command::new("claptests")));
2020-01-31 09:13:44 +00:00
}
2015-09-01 16:00:51 +00:00
2020-03-05 09:06:17 +00:00
pub fn parse_empty(c: &mut Criterion) {
c.bench_function("parse_empty", |b| {
2022-02-12 03:48:29 +00:00
b.iter(|| Command::new("claptests").get_matches_from(vec![""]))
2020-02-21 00:12:28 +00:00
});
2020-01-31 09:13:44 +00:00
}
2020-02-17 18:14:19 +00:00
2020-03-05 09:06:17 +00:00
criterion_group!(benches, build_empty, parse_empty);
2020-02-17 18:14:19 +00:00
criterion_main!(benches);