Skip to content

Commit a9ab2a7

Browse files
committed
adjust channel sizes
1 parent db85e7e commit a9ab2a7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ use std::thread;
225225
use std::thread::JoinHandle;
226226
use 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() {

0 commit comments

Comments
 (0)