Skip to content

Commit 3ef6203

Browse files
samfordKeats
authored andcommitted
Fix benchmarks (#901)
* 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.
1 parent 6b5768f commit 3ef6203

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

components/rendering/benches/all.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#![feature(test)]
2+
extern crate test;
3+
14
use std::collections::HashMap;
2-
use std::path::Path;
35

46
use config::Config;
57
use front_matter::InsertAnchor;
@@ -85,7 +87,7 @@ fn bench_render_content_with_highlighting(b: &mut test::Bencher) {
8587
let permalinks_ctx = HashMap::new();
8688
let config = Config::default();
8789
let context =
88-
RenderContext::new(&tera, &config, "", &permalinks_ctx, Path::new(""), InsertAnchor::None);
90+
RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None);
8991
b.iter(|| render_content(CONTENT, &context).unwrap());
9092
}
9193

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

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

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

126128
b.iter(|| render_shortcodes(CONTENT, &context));
127129
}

components/site/benches/load.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! Benchmarking loading/markdown rendering of generated sites of various sizes
2+
#![feature(test)]
3+
extern crate test;
4+
25
use std::env;
36

47
use site::Site;

components/site/benches/site.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![feature(test)]
2+
extern crate test;
3+
14
use std::env;
25

36
use library::Paginator;

0 commit comments

Comments
 (0)