parallelUnorderedMap

Processes a range of items in worker tasks and returns them as an unordered range.

The order of the result stream can deviate from the order of the input items, but the approach is more efficient that an ordered map.#

  1. auto parallelUnorderedMap(R items, shared(TaskPool) task_pool, ChannelConfig channel_config)
    parallelUnorderedMap
    (
    alias fun
    R
    )
    if (
    isInputRange!R &&
    isWeaklyIsolated!(ElementType!R)
    &&
    isWeaklyIsolated!(typeof(fun(ElementType!R.init)))
    )
  2. auto parallelUnorderedMap(R items, ChannelConfig channel_config)

Examples

import std.algorithm : isPermutation, map;
import std.array : array;
import std.range : iota;

auto res = iota(100)
	.parallelMap!(i => 2 * i)
	.array;
assert(res.isPermutation(iota(100).map!(i => 2 * i).array));

See Also

parallelMap

Meta