Skip to main content

Module parallel

Module parallel 

Source
Expand description

Parallel for each and map using tokio tasks.

This avoid the problem of sleeping threads with mimalloc when using rayon in combination with tokio. It also avoid having multiple thread pools.

See also: https://pwy.io/posts/mimalloc-cigarette/

Functions§

available_parallelism
Returns the recommended amount of parallelism for the current process. Typically the number of available CPU cores.
for_each
for_each_chunk
Like for_each, but calls f once per chunk instead of once per item. A slice too small to be chunked is passed to f as a whole on the calling thread, and an empty slice doesn’t call f. Uses the same chunk sizing as for_each.
for_each_owned
map_collect
map_collect_chunked_owned
map_collect_owned
try_for_each
try_for_each_mut
try_for_each_owned