Some more benches

This commit is contained in:
Vincent Prouillet 2018-09-18 17:19:59 +02:00
parent 5876a67100
commit 91adc03bdd
2 changed files with 20 additions and 1 deletions

View file

@ -87,3 +87,23 @@ fn bench_populate_sections_medium_kb(b: &mut test::Bencher) {
b.iter(|| site.populate_sections());
}
#[bench]
fn bench_render_markdown_small_blog(b: &mut test::Bencher) {
let mut site = setup_site("small-blog");
let tmp_dir = tempdir().expect("create temp dir");
let public = &tmp_dir.path().join("public");
site.set_output_path(&public);
b.iter(|| site.render_markdown());
}
#[bench]
fn bench_render_markdown_small_kb(b: &mut test::Bencher) {
let mut site = setup_site("small-kb");
let tmp_dir = tempdir().expect("create temp dir");
let public = &tmp_dir.path().join("public");
site.set_output_path(&public);
b.iter(|| site.render_markdown());
}

View file

@ -260,7 +260,6 @@ impl Site {
let config = &self.config;
let base_path = &self.base_path;
// TODO: avoid the duplication with function above for that part
// This is needed in the first place because of silly borrow checker
let mut pages_insert_anchors = HashMap::new();
for (_, p) in &self.pages {