Browse Source

Add one bench for rendering html of page

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
3022598649
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      components/content/benches/all.rs

components/content/benches/sorting.rs → components/content/benches/all.rs View File

@@ -133,3 +133,16 @@ fn bench_populate_previous_and_next_pages(b: &mut test::Bencher) {
let (sorted_pages, _) = sort_pages(pages, SortBy::Order); let (sorted_pages, _) = sort_pages(pages, SortBy::Order);
b.iter(|| populate_previous_and_next_pages(sorted_pages.clone())); 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());
}

Loading…
Cancel
Save