Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix benchmarks (rendering, site) #901

Merged
merged 1 commit into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions components/rendering/benches/all.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![feature(test)]
extern crate test;

use std::collections::HashMap;
use std::path::Path;

use config::Config;
use front_matter::InsertAnchor;
Expand Down Expand Up @@ -85,7 +87,7 @@ fn bench_render_content_with_highlighting(b: &mut test::Bencher) {
let permalinks_ctx = HashMap::new();
let config = Config::default();
let context =
RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new(""), InsertAnchor::None);
RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
b.iter(|| render_content(CONTENT, &context).unwrap());
}

Expand All @@ -97,7 +99,7 @@ fn bench_render_content_without_highlighting(b: &mut test::Bencher) {
let mut config = Config::default();
config.highlight_code = false;
let context =
RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new(""), InsertAnchor::None);
RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
b.iter(|| render_content(CONTENT, &context).unwrap());
}

Expand All @@ -109,7 +111,7 @@ fn bench_render_content_no_shortcode(b: &mut test::Bencher) {
config.highlight_code = false;
let permalinks_ctx = HashMap::new();
let context =
RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new(""), InsertAnchor::None);
RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);

b.iter(|| render_content(&content2, &context).unwrap());
}
Expand All @@ -121,7 +123,7 @@ fn bench_render_shortcodes_one_present(b: &mut test::Bencher) {
let config = Config::default();
let permalinks_ctx = HashMap::new();
let context =
RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new(""), InsertAnchor::None);
RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);

b.iter(|| render_shortcodes(CONTENT, &context));
}
3 changes: 3 additions & 0 deletions components/site/benches/load.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//! Benchmarking loading/markdown rendering of generated sites of various sizes
#![feature(test)]
extern crate test;

use std::env;

use site::Site;
Expand Down
3 changes: 3 additions & 0 deletions components/site/benches/site.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![feature(test)]
extern crate test;

use std::env;

use library::Paginator;
Expand Down