Skip to content

Commit f23f86f

Browse files
committed
perf: don't try to steal from empty workers
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 45f202a commit f23f86f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

vortex-scan/src/multi_scan.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ impl<T: Send + Sync + 'static> Iterator for MultiScanIterator<T> {
102102
let stealer_id = self.next_stealer_id.fetch_add(1, SeqCst) % stealer_count;
103103
let stealer = &self.stealers.read()[stealer_id];
104104

105-
// Attempt to steal ~half of the work and push it into `worker`.
106-
if let Steal::Success(_) = stealer.steal_batch(&self.worker) {
107-
break;
105+
if !stealer.is_empty() {
106+
// Attempt to steal ~half of the work and push it into `worker`.
107+
if let Steal::Success(_) = stealer.steal_batch(&self.worker) {
108+
break;
109+
}
108110
}
109111
}
110112
}

0 commit comments

Comments
 (0)