File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545
4646// Zip
4747
48- const COLLECT_MAX_PARTS : usize = 256 ;
48+ const COLLECT_MAX_SPLITS : usize = 10 ;
4949
5050macro_rules! zip_impl {
5151 ( $( [ $notlast: ident $( $p: ident) * ] , ) +) => {
@@ -92,7 +92,7 @@ macro_rules! zip_impl {
9292 ParallelSplits {
9393 iter: self . and( SendProducer :: new( output. raw_view_mut( ) . cast:: <R >( ) ) ) ,
9494 // Keep it from splitting the Zip down too small
95- min_size : total_len / COLLECT_MAX_PARTS ,
95+ max_splits : COLLECT_MAX_SPLITS ,
9696 }
9797 } ;
9898
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ zip_impl! {
288288/// or producer `P`.
289289pub ( crate ) struct ParallelSplits < P > {
290290 pub ( crate ) iter : P ,
291- pub ( crate ) min_size : usize ,
291+ pub ( crate ) max_splits : usize ,
292292}
293293
294294impl < P > ParallelIterator for ParallelSplits < P >
@@ -313,17 +313,17 @@ impl<P> UnindexedProducer for ParallelSplits<P>
313313 type Item = P ;
314314
315315 fn split ( self ) -> ( Self , Option < Self > ) {
316- if self . iter . size ( ) <= self . min_size || !self . iter . can_split ( ) {
316+ if self . max_splits == 0 || !self . iter . can_split ( ) {
317317 return ( self , None )
318318 }
319319 let ( a, b) = self . iter . split ( ) ;
320320 ( ParallelSplits {
321321 iter : a,
322- min_size : self . min_size ,
322+ max_splits : self . max_splits - 1 ,
323323 } ,
324324 Some ( ParallelSplits {
325325 iter : b,
326- min_size : self . min_size ,
326+ max_splits : self . max_splits - 1 ,
327327 } ) )
328328 }
329329
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ pub(crate) trait SplitAt {
88
99pub ( crate ) trait SplitPreference : SplitAt {
1010 fn can_split ( & self ) -> bool ;
11- fn size ( & self ) -> usize ;
1211 fn split_preference ( & self ) -> ( Axis , usize ) ;
1312 fn split ( self ) -> ( Self , Self ) where Self : Sized {
1413 let ( axis, index) = self . split_preference ( ) ;
Original file line number Diff line number Diff line change @@ -1126,8 +1126,6 @@ macro_rules! map_impl {
11261126 {
11271127 fn can_split( & self ) -> bool { self . size( ) > 1 }
11281128
1129- fn size( & self ) -> usize { self . size( ) }
1130-
11311129 fn split_preference( & self ) -> ( Axis , usize ) {
11321130 // Always split in a way that preserves layout (if any)
11331131 let axis = self . max_stride_axis( ) ;
You can’t perform that action at this time.
0 commit comments