Skip to content

Commit

Permalink
Slightly expand bench
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Sep 7, 2022
1 parent e7215fb commit 14da964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions benchmarks/benches/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fn do_render(env: &Environment) {
context!{url => "/doc", is_active => false, title => "Docs"},
context!{url => "/help", is_active => false, title => "Help"},
]
}
},
items => (0..200).skip(3).collect::<Vec<_>>(),
})
.unwrap();
}
Expand All @@ -49,9 +50,9 @@ fn create_real_env() -> Environment<'static> {
}

pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("parse all_elements", |b| b.iter(|| do_parse()));
c.bench_function("parse all_elements", |b| b.iter(do_parse));
c.bench_function("parse+compile all_elements", |b| {
b.iter(|| do_parse_and_compile())
b.iter(do_parse_and_compile)
});
c.bench_function("render all_elements", |b| {
let env = create_real_env();
Expand Down
8 changes: 7 additions & 1 deletion benchmarks/inputs/all_elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ <h1>Hello</h1>
</nav>
</header>
<main>
{% block body %}{% endblock %}
{% block body %}
<ul>
{% for item in items %}
<li>{{ loop.index }}: {{ item }}</li>
{% endfor %}
</ul>
{% endblock %}
</main>
<footer>
{% block footer %}
Expand Down

0 comments on commit 14da964

Please sign in to comment.