File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " zapper"
3
- version = " 0.1.7 "
3
+ version = " 0.1.8 "
4
4
authors = [" Josh Leverette <coder543@gmail.com>" ]
5
5
license = " MIT"
6
6
description = " lightning fast templating engine"
@@ -14,8 +14,6 @@ derive = ["zapper_derive"]
14
14
zapper_derive = { version = " 0.1.0" , optional = true }
15
15
rayon = { version = " 1.0.1" , optional = true }
16
16
17
- # uncomment if doing benchmarks
18
- # otherwise, it just slows down compilation of examples
19
17
[dev-dependencies ]
20
18
criterion = " 0.2.3"
21
19
handlebars = " 0.32.0"
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ fn bench_zapper_par(c: &mut Criterion) {
117
117
c. bench_function ( "zapper_par" , move |b| {
118
118
b. iter ( || {
119
119
let mut output = Vec :: new ( ) ;
120
- bytecode. par_render ( & group, & mut output, 20 ) . unwrap ( ) ;
120
+ bytecode. par_render ( & group, & mut output, 50 ) . unwrap ( ) ;
121
121
output
122
122
} )
123
123
} ) ;
@@ -133,7 +133,7 @@ fn bench_hbs(c: &mut Criterion) {
133
133
. unwrap ( ) ;
134
134
135
135
let mut group = vec ! [ ] ;
136
- for i in 0 ..100 {
136
+ for i in 0 ..1000 {
137
137
group. push ( Person {
138
138
id : 12 + i,
139
139
name : "Bob" . to_string ( ) ,
Original file line number Diff line number Diff line change 80
80
/// It is less efficient, but given the right par_chunk_size and right number
81
81
/// of cores, it can increase total throughput.
82
82
///
83
- /// A recommended starting point for par_chunk_size is 20 .
83
+ /// A recommended starting point for par_chunk_size is 50 .
84
84
#[ cfg( feature = "rayon" ) ]
85
85
pub fn par_render < ' b , RunnerItem , Writer > (
86
86
& self ,
@@ -100,12 +100,14 @@ impl<
100
100
. par_chunks ( par_chunk_size)
101
101
. map ( |items| {
102
102
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
+
104
105
for item in items {
105
106
self . render_with ( item, & mut write_buf, stack, buffer) ?;
106
107
}
107
108
output. lock ( ) . unwrap ( ) . write_all ( & write_buf) ?;
108
- return Ok ( ( ) ) ;
109
+
110
+ Ok ( ( ) )
109
111
} )
110
112
} )
111
113
. collect ( )
You can’t perform that action at this time.
0 commit comments