Skip to content

Commit ffb097d

Browse files
committed
accept that dev-deps don't need to be commented out, slight par tweaks
1 parent d37643d commit ffb097d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zapper"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
authors = ["Josh Leverette <coder543@gmail.com>"]
55
license = "MIT"
66
description = "lightning fast templating engine"
@@ -14,8 +14,6 @@ derive = ["zapper_derive"]
1414
zapper_derive = { version = "0.1.0", optional = true }
1515
rayon = { version = "1.0.1", optional = true }
1616

17-
# uncomment if doing benchmarks
18-
# otherwise, it just slows down compilation of examples
1917
[dev-dependencies]
2018
criterion = "0.2.3"
2119
handlebars = "0.32.0"

benches/benchmark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn bench_zapper_par(c: &mut Criterion) {
117117
c.bench_function("zapper_par", move |b| {
118118
b.iter(|| {
119119
let mut output = Vec::new();
120-
bytecode.par_render(&group, &mut output, 20).unwrap();
120+
bytecode.par_render(&group, &mut output, 50).unwrap();
121121
output
122122
})
123123
});
@@ -133,7 +133,7 @@ fn bench_hbs(c: &mut Criterion) {
133133
.unwrap();
134134

135135
let mut group = vec![];
136-
for i in 0..100 {
136+
for i in 0..1000 {
137137
group.push(Person {
138138
id: 12 + i,
139139
name: "Bob".to_string(),

src/bytecode.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<
8080
/// It is less efficient, but given the right par_chunk_size and right number
8181
/// of cores, it can increase total throughput.
8282
///
83-
/// A recommended starting point for par_chunk_size is 20.
83+
/// A recommended starting point for par_chunk_size is 50.
8484
#[cfg(feature = "rayon")]
8585
pub fn par_render<'b, RunnerItem, Writer>(
8686
&self,
@@ -100,12 +100,14 @@ impl<
100100
.par_chunks(par_chunk_size)
101101
.map(|items| {
102102
STORE.with(|(ref mut stack, ref mut buffer)| {
103-
let mut write_buf = Vec::with_capacity(8);
103+
let mut write_buf = Vec::with_capacity(8 * par_chunk_size);
104+
104105
for item in items {
105106
self.render_with(item, &mut write_buf, stack, buffer)?;
106107
}
107108
output.lock().unwrap().write_all(&write_buf)?;
108-
return Ok(());
109+
110+
Ok(())
109111
})
110112
})
111113
.collect()

0 commit comments

Comments
 (0)