summaryrefslogtreecommitdiffstats
path: root/benches
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-04-12 13:17:05 -0400
committerMatan Kushner <hello@matchai.me>2019-04-12 13:17:05 -0400
commit653b9c1d5c4a7da21911a3b6d65aa2fd058bc341 (patch)
treecb78fe41fa9a69cbcf658048cef0587b36340fec /benches
parentab9ba27231c59ddfdb0b51b073835cc7d0849f80 (diff)
Add missing benchmarks
Diffstat (limited to 'benches')
-rw-r--r--benches/benchmarks.rs36
1 files changed, 30 insertions, 6 deletions
diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs
index beb7eede7..5da21f04c 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) {
+ 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)
});
}