File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -136,3 +136,39 @@ fn rayon_add(bench: &mut Bencher) {
136
136
} ) ;
137
137
} ) ;
138
138
}
139
+
140
+ const COLL_STRING_N : usize = 64 ;
141
+ const COLL_F64_N : usize = 128 ;
142
+
143
+ #[ bench]
144
+ fn vec_string_collect ( bench : & mut test:: Bencher ) {
145
+ let v = vec ! [ "" ; COLL_STRING_N * COLL_STRING_N ] ;
146
+ bench. iter ( || {
147
+ v. iter ( ) . map ( |s| s. to_owned ( ) ) . collect :: < Vec < _ > > ( )
148
+ } ) ;
149
+ }
150
+
151
+ #[ bench]
152
+ fn array_string_collect ( bench : & mut test:: Bencher ) {
153
+ let v = Array :: from_elem ( ( COLL_STRING_N , COLL_STRING_N ) , "" ) ;
154
+ bench. iter ( || {
155
+ Zip :: from ( & v) . par_apply_collect ( |s| s. to_owned ( ) )
156
+ } ) ;
157
+ }
158
+
159
+ #[ bench]
160
+ fn vec_f64_collect ( bench : & mut test:: Bencher ) {
161
+ let v = vec ! [ 1. ; COLL_F64_N * COLL_F64_N ] ;
162
+ bench. iter ( || {
163
+ v. iter ( ) . map ( |s| s + 1. ) . collect :: < Vec < _ > > ( )
164
+ } ) ;
165
+ }
166
+
167
+ #[ bench]
168
+ fn array_f64_collect ( bench : & mut test:: Bencher ) {
169
+ let v = Array :: from_elem ( ( COLL_F64_N , COLL_F64_N ) , 1. ) ;
170
+ bench. iter ( || {
171
+ Zip :: from ( & v) . par_apply_collect ( |s| s + 1. )
172
+ } ) ;
173
+ }
174
+
You can’t perform that action at this time.
0 commit comments