File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 45
45
46
46
// Zip
47
47
48
- const COLLECT_MAX_PARTS : usize = 256 ;
48
+ const COLLECT_MAX_SPLITS : usize = 10 ;
49
49
50
50
macro_rules! zip_impl {
51
51
( $( [ $notlast: ident $( $p: ident) * ] , ) +) => {
@@ -92,7 +92,7 @@ macro_rules! zip_impl {
92
92
ParallelSplits {
93
93
iter: self . and( SendProducer :: new( output. raw_view_mut( ) . cast:: <R >( ) ) ) ,
94
94
// Keep it from splitting the Zip down too small
95
- min_size : total_len / COLLECT_MAX_PARTS ,
95
+ max_splits : COLLECT_MAX_SPLITS ,
96
96
}
97
97
} ;
98
98
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ zip_impl! {
288
288
/// or producer `P`.
289
289
pub ( crate ) struct ParallelSplits < P > {
290
290
pub ( crate ) iter : P ,
291
- pub ( crate ) min_size : usize ,
291
+ pub ( crate ) max_splits : usize ,
292
292
}
293
293
294
294
impl < P > ParallelIterator for ParallelSplits < P >
@@ -313,17 +313,17 @@ impl<P> UnindexedProducer for ParallelSplits<P>
313
313
type Item = P ;
314
314
315
315
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 ( ) {
317
317
return ( self , None )
318
318
}
319
319
let ( a, b) = self . iter . split ( ) ;
320
320
( ParallelSplits {
321
321
iter : a,
322
- min_size : self . min_size ,
322
+ max_splits : self . max_splits - 1 ,
323
323
} ,
324
324
Some ( ParallelSplits {
325
325
iter : b,
326
- min_size : self . min_size ,
326
+ max_splits : self . max_splits - 1 ,
327
327
} ) )
328
328
}
329
329
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ pub(crate) trait SplitAt {
8
8
9
9
pub ( crate ) trait SplitPreference : SplitAt {
10
10
fn can_split ( & self ) -> bool ;
11
- fn size ( & self ) -> usize ;
12
11
fn split_preference ( & self ) -> ( Axis , usize ) ;
13
12
fn split ( self ) -> ( Self , Self ) where Self : Sized {
14
13
let ( axis, index) = self . split_preference ( ) ;
Original file line number Diff line number Diff line change @@ -1126,8 +1126,6 @@ macro_rules! map_impl {
1126
1126
{
1127
1127
fn can_split( & self ) -> bool { self . size( ) > 1 }
1128
1128
1129
- fn size( & self ) -> usize { self . size( ) }
1130
-
1131
1129
fn split_preference( & self ) -> ( Axis , usize ) {
1132
1130
// Always split in a way that preserves layout (if any)
1133
1131
let axis = self . max_stride_axis( ) ;
You can’t perform that action at this time.
0 commit comments