|
|
@@ -1,5 +1,7 @@ |
|
|
|
#![feature(test)] |
|
|
|
extern crate test; |
|
|
|
|
|
|
|
use std::collections::HashMap; |
|
|
|
use std::path::Path; |
|
|
|
|
|
|
|
use config::Config; |
|
|
|
use front_matter::InsertAnchor; |
|
|
@@ -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()); |
|
|
|
} |
|
|
|
|
|
|
@@ -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()); |
|
|
|
} |
|
|
|
|
|
|
@@ -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()); |
|
|
|
} |
|
|
@@ -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)); |
|
|
|
} |