@@ -125,86 +125,6 @@ fn read_namespaced_event(c: &mut Criterion) {
125
125
group. finish ( ) ;
126
126
}
127
127
128
- /// Benchmarks the `BytesText::unescaped()` method (includes time of `read_event`
129
- /// benchmark)
130
- fn bytes_text_unescaped ( c : & mut Criterion ) {
131
- let mut group = c. benchmark_group ( "BytesText::unescaped" ) ;
132
- group. bench_function ( "trim_text = false" , |b| {
133
- b. iter ( || {
134
- let mut buf = Vec :: new ( ) ;
135
- let mut r = Reader :: from_reader ( SAMPLE ) ;
136
- r. check_end_names ( false ) . check_comments ( false ) ;
137
- let mut count = criterion:: black_box ( 0 ) ;
138
- let mut nbtxt = criterion:: black_box ( 0 ) ;
139
- loop {
140
- match r. read_event_into ( & mut buf) {
141
- Ok ( Event :: Start ( _) ) | Ok ( Event :: Empty ( _) ) => count += 1 ,
142
- Ok ( Event :: Text ( ref e) ) => nbtxt += e. unescaped ( ) . unwrap ( ) . len ( ) ,
143
- Ok ( Event :: Eof ) => break ,
144
- _ => ( ) ,
145
- }
146
- buf. clear ( ) ;
147
- }
148
- assert_eq ! (
149
- count, 1550 ,
150
- "Overall tag count in ./tests/documents/sample_rss.xml"
151
- ) ;
152
-
153
- // Windows has \r\n instead of \n
154
- #[ cfg( windows) ]
155
- assert_eq ! (
156
- nbtxt, 67661 ,
157
- "Overall length (in bytes) of all text contents of ./tests/documents/sample_rss.xml"
158
- ) ;
159
-
160
- #[ cfg( not( windows) ) ]
161
- assert_eq ! (
162
- nbtxt, 66277 ,
163
- "Overall length (in bytes) of all text contents of ./tests/documents/sample_rss.xml"
164
- ) ;
165
- } ) ;
166
- } ) ;
167
-
168
- group. bench_function ( "trim_text = true" , |b| {
169
- b. iter ( || {
170
- let mut buf = Vec :: new ( ) ;
171
- let mut r = Reader :: from_reader ( SAMPLE ) ;
172
- r. check_end_names ( false )
173
- . check_comments ( false )
174
- . trim_text ( true ) ;
175
- let mut count = criterion:: black_box ( 0 ) ;
176
- let mut nbtxt = criterion:: black_box ( 0 ) ;
177
- loop {
178
- match r. read_event_into ( & mut buf) {
179
- Ok ( Event :: Start ( _) ) | Ok ( Event :: Empty ( _) ) => count += 1 ,
180
- Ok ( Event :: Text ( ref e) ) => nbtxt += e. unescaped ( ) . unwrap ( ) . len ( ) ,
181
- Ok ( Event :: Eof ) => break ,
182
- _ => ( ) ,
183
- }
184
- buf. clear ( ) ;
185
- }
186
- assert_eq ! (
187
- count, 1550 ,
188
- "Overall tag count in ./tests/documents/sample_rss.xml"
189
- ) ;
190
-
191
- // Windows has \r\n instead of \n
192
- #[ cfg( windows) ]
193
- assert_eq ! (
194
- nbtxt, 50334 ,
195
- "Overall length (in bytes) of all text contents of ./tests/documents/sample_rss.xml"
196
- ) ;
197
-
198
- #[ cfg( not( windows) ) ]
199
- assert_eq ! (
200
- nbtxt, 50261 ,
201
- "Overall length (in bytes) of all text contents of ./tests/documents/sample_rss.xml"
202
- ) ;
203
- } ) ;
204
- } ) ;
205
- group. finish ( ) ;
206
- }
207
-
208
128
/// Benchmarks, how fast individual event parsed
209
129
fn one_event ( c : & mut Criterion ) {
210
130
let mut group = c. benchmark_group ( "One event" ) ;
@@ -473,7 +393,6 @@ purus. Consequat id porta nibh venenatis cras sed felis.";
473
393
criterion_group ! (
474
394
benches,
475
395
read_event,
476
- bytes_text_unescaped,
477
396
read_namespaced_event,
478
397
one_event,
479
398
attributes,
0 commit comments