From 91adc03bdd8e4012755420b0034bcda5312f0cda Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 18 Sep 2018 17:19:59 +0200 Subject: [PATCH] Some more benches --- components/site/benches/site.rs | 20 ++++++++++++++++++++ components/site/src/lib.rs | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/components/site/benches/site.rs b/components/site/benches/site.rs index e1100de..79e2ec6 100644 --- a/components/site/benches/site.rs +++ b/components/site/benches/site.rs @@ -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()); +} diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index e5ef806..c0a0559 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -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 {