Skip to content

Commit

Permalink
Fix benchmarks (#901)
Browse files Browse the repository at this point in the history
* Restore #![feature(test)] and extern crate test; statements, which
were mistakenly removed as part of the Rust 2018 edition migration.

* Fix rendering benchmark's usage of RenderContext. 6 parameters were
provided when 5 were expected.
  • Loading branch information
samford authored and Keats committed Dec 26, 2019
1 parent 2773ca8 commit f5dce64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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

0 comments on commit f5dce64

Please sign in to comment.