aoc::util::thread

Function spawn_parallel_iterator

Source
pub fn spawn_parallel_iterator<F, T>(items: &[T], f: F)
where F: Fn(ParIter<'_, T>) + Copy + Send, T: Sync,
Expand description

Spawns n scoped threads that each receive a work stealing iterator. Work stealing is an efficient strategy that keeps each CPU core busy when some items take longer than other to process, used by popular libraries such as rayon. Processing at different rates also happens on many modern CPUs with heterogeneous performance and efficiency cores.