Update benches

embed
Manos Pitsidianakis 2018-08-04 20:30:21 +03:00
parent 6ebab37a3d
commit d5c0542f61
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
4 changed files with 36 additions and 6 deletions

12
README
View File

@ -9,6 +9,18 @@
terminal mail user agent terminal mail user agent
config
======
# $XDG_CONFIG_HOME/meli/config
profiling:
==========
# perf record -g target/debug/bin
# perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg
/ / / /
/_/ | /_/ |
/ \/ / \/

View File

@ -1,5 +1,6 @@
#![feature(test)] #![feature(test)]
extern crate melib; extern crate melib;
use melib::conf::Folder;
use melib::mailbox::backends::maildir::*; use melib::mailbox::backends::maildir::*;
extern crate test; extern crate test;
@ -7,21 +8,36 @@ use self::test::Bencher;
#[bench] #[bench]
fn bench_threads_1(b: &mut Bencher) { fn bench_threads_1(b: &mut Bencher) {
b.iter(|| MaildirType::new("").get_multicore(1)); b.iter(|| {
let folder = Folder::new(String::from(""), vec![]);
MaildirType::new("").multicore(1, &folder)
});
} }
#[bench] #[bench]
fn bench_threads_2(b: &mut Bencher) { fn bench_threads_2(b: &mut Bencher) {
b.iter(|| MaildirType::new("").get_multicore(2)); b.iter(|| {
let folder = Folder::new(String::from(""), vec![]);
MaildirType::new("").multicore(2, &folder)
});
} }
#[bench] #[bench]
fn bench_threads_3(b: &mut Bencher) { fn bench_threads_3(b: &mut Bencher) {
b.iter(|| MaildirType::new("").get_multicore(3)); b.iter(|| {
let folder = Folder::new(String::from(""), vec![]);
MaildirType::new("").multicore(3, &folder)
});
} }
#[bench] #[bench]
fn bench_threads_4(b: &mut Bencher) { fn bench_threads_4(b: &mut Bencher) {
b.iter(|| MaildirType::new("").get_multicore(4)); b.iter(|| {
let folder = Folder::new(String::from(""), vec![]);
MaildirType::new("").multicore(4, &folder)
});
} }
#[bench] #[bench]
fn bench_threads_6(b: &mut Bencher) { fn bench_threads_6(b: &mut Bencher) {
b.iter(|| MaildirType::new("").get_multicore(6)); b.iter(|| {
let folder = Folder::new(String::from(""), vec![]);
MaildirType::new("").multicore(6, &folder)
});
} }

View File

@ -8,6 +8,7 @@ use melib::mailbox::email::Envelope;
extern crate test; extern crate test;
use self::test::Bencher; use self::test::Bencher;
/*
#[bench] #[bench]
fn mail_parse(b: &mut Bencher) { fn mail_parse(b: &mut Bencher) {
b.iter(|| { b.iter(|| {
@ -16,3 +17,4 @@ fn mail_parse(b: &mut Bencher) {
})))) }))))
}); });
} }
*/

View File

@ -41,7 +41,7 @@ pub struct Folder {
} }
impl Folder { impl Folder {
fn new(path: String, file_name: String, children: Vec<usize>) -> Self { pub fn new(path: String, file_name: String, children: Vec<usize>) -> Self {
let mut h = DefaultHasher::new(); let mut h = DefaultHasher::new();
h.write(&path.as_bytes()); h.write(&path.as_bytes());
Folder { Folder {