File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -306,3 +306,31 @@ fn bench_skip_then_zip(b: &mut Bencher) {
306
306
assert_eq ! ( s, 2009900 ) ;
307
307
} ) ;
308
308
}
309
+
310
+ #[ bench]
311
+ fn bench_filter_count ( b : & mut Bencher ) {
312
+ b. iter ( || {
313
+ ( 0i64 ..1000000 ) . map ( black_box) . filter ( |x| x % 3 == 0 ) . count ( )
314
+ } )
315
+ }
316
+
317
+ #[ bench]
318
+ fn bench_filter_ref_count ( b : & mut Bencher ) {
319
+ b. iter ( || {
320
+ ( 0i64 ..1000000 ) . map ( black_box) . by_ref ( ) . filter ( |x| x % 3 == 0 ) . count ( )
321
+ } )
322
+ }
323
+
324
+ #[ bench]
325
+ fn bench_filter_chain_count ( b : & mut Bencher ) {
326
+ b. iter ( || {
327
+ ( 0i64 ..1000000 ) . chain ( 0 ..1000000 ) . map ( black_box) . filter ( |x| x % 3 == 0 ) . count ( )
328
+ } )
329
+ }
330
+
331
+ #[ bench]
332
+ fn bench_filter_chain_ref_count ( b : & mut Bencher ) {
333
+ b. iter ( || {
334
+ ( 0i64 ..1000000 ) . chain ( 0 ..1000000 ) . map ( black_box) . by_ref ( ) . filter ( |x| x % 3 == 0 ) . count ( )
335
+ } )
336
+ }
You can’t perform that action at this time.
0 commit comments