File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -225,7 +225,8 @@ use std::thread;
225225use std:: thread:: JoinHandle ;
226226use std:: time:: Duration ;
227227
228- const MAX_SIZE_FOR_THREAD : usize = 100 ;
228+ const MAX_SIZE_FOR_THREAD : usize = 128 ;
229+ const BUFFER_SIZE : usize = 64 ;
229230
230231///
231232/// lock-free sequential parallel iterator
@@ -481,7 +482,7 @@ impl<R> ParIterSync<R>
481482 let task_registry: TaskRegistry = TaskRegistry :: new ( ( 1 + MAX_SIZE_FOR_THREAD ) * cpus) ;
482483
483484 // this thread dispatches tasks to worker threads
484- let ( dispatcher, task_receiver) = bounded ( MAX_SIZE_FOR_THREAD * cpus ) ;
485+ let ( dispatcher, task_receiver) = bounded ( BUFFER_SIZE ) ;
485486 let sender_thread = thread:: spawn ( move || {
486487 for ( task_id, t) in tasks. into_iter ( ) . enumerate ( ) {
487488 if dispatcher. send ( ( t, task_id) ) . is_err ( ) {
You can’t perform that action at this time.
0 commit comments