diff options
author | Matan Kushner <hello@matchai.me> | 2019-04-12 13:07:41 -0400 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-04-12 13:07:41 -0400 |
commit | 99bdf27ecac655b54b03d7389b1b24970a1ec9ec (patch) | |
tree | acf2b6db45712d768d0247dc42126bc44a89a0d9 /benches | |
parent | 7ffadd37bc3feaae3b636f64169176c041f6684a (diff) |
Parallelize nodejs file checks
Diffstat (limited to 'benches')
-rw-r--r-- | benches/benchmarks.rs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index beb7eede7..94960d26f 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -8,37 +8,61 @@ 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"]); + + // starship::print::prompt(args) + // }); + // } + #[bench] - fn full_prompt_bench(b: &mut Bencher) { + fn char_section_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) + let segment = modules::handle("char", &args); + print::stringify_segment(segment) }); } #[bench] - fn char_section_bench(b: &mut Bencher) { + fn dir_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("char", &args); + let segment = modules::handle("dir", &args); print::stringify_segment(segment) }); } - #[bench] - fn dir_section_bench(b: &mut Bencher) { + #[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("dir", &args); + 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) }); } |