From 653b9c1d5c4a7da21911a3b6d65aa2fd058bc341 Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Fri, 12 Apr 2019 13:17:05 -0400 Subject: [PATCH] Add missing benchmarks --- benches/benchmarks.rs | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index beb7eede..5da21f04 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -8,16 +8,16 @@ mod tests { use starship::{modules, print}; use test::Bencher; - #[bench] - fn full_prompt_bench(b: &mut Bencher) { - b.iter(|| { - let args = App::new("starship") - .arg(Arg::with_name("status_code")) - .get_matches_from(vec!["starship", "0"]); + // #[bench] + // fn full_prompt_bench(b: &mut Bencher) { + // b.iter(|| { + // let args = App::new("starship") + // .arg(Arg::with_name("status_code")) + // .get_matches_from(vec!["starship", "0"]); - starship::print::prompt(args) - }); - } + // starship::print::prompt(args) + // }); + // } #[bench] fn char_section_bench(b: &mut Bencher) { @@ -42,4 +42,28 @@ mod tests { print::stringify_segment(segment) }); } + + #[bench] + fn line_break_section_bench(b: &mut Bencher) { + b.iter(|| { + let args = App::new("starship") + .arg(Arg::with_name("status_code")) + .get_matches_from(vec!["starship", "0"]); + + let segment = modules::handle("line_break", &args); + print::stringify_segment(segment) + }); + } + + #[bench] + fn nodejs_section_bench(b: &mut Bencher) { + b.iter(|| { + let args = App::new("starship") + .arg(Arg::with_name("status_code")) + .get_matches_from(vec!["starship", "0"]); + + let segment = modules::handle("nodejs", &args); + print::stringify_segment(segment) + }); + } }