From 3022598649076552124624d4dc3323fbb5e0bf94 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 4 Jul 2017 19:55:28 +0900 Subject: [PATCH] Add one bench for rendering html of page --- components/content/benches/{sorting.rs => all.rs} | 13 +++++++++++++ 1 file changed, 13 insertions(+) rename components/content/benches/{sorting.rs => all.rs} (89%) diff --git a/components/content/benches/sorting.rs b/components/content/benches/all.rs similarity index 89% rename from components/content/benches/sorting.rs rename to components/content/benches/all.rs index 5803e40f..19b5454c 100644 --- a/components/content/benches/sorting.rs +++ b/components/content/benches/all.rs @@ -133,3 +133,16 @@ fn bench_populate_previous_and_next_pages(b: &mut test::Bencher) { let (sorted_pages, _) = sort_pages(pages, SortBy::Order); b.iter(|| populate_previous_and_next_pages(sorted_pages.clone())); } + +#[bench] +fn bench_page_render_html(b: &mut test::Bencher) { + let pages = create_pages(10, SortBy::Order); + let (mut sorted_pages, _) = sort_pages(pages, SortBy::Order); + sorted_pages = populate_previous_and_next_pages(sorted_pages.clone()); + + let config = Config::default(); + let mut tera = Tera::default(); + tera.add_raw_template("page.html", "{{ page.content }}").unwrap(); + let page = &sorted_pages[5]; + b.iter(|| page.render_html(&tera, &config).unwrap()); +}