Browse Source

Some more benches

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
91adc03bdd
2 changed files with 20 additions and 1 deletions
  1. +20
    -0
      components/site/benches/site.rs
  2. +0
    -1
      components/site/src/lib.rs

+ 20
- 0
components/site/benches/site.rs 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());
}

+ 0
- 1
components/site/src/lib.rs 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 {


Loading…
Cancel
Save