Add one bench for rendering html of page
This commit is contained in:
parent
2227b8646c
commit
3022598649
|
@ -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…
Reference in a new issue