On Monday, 4 March 2013 at 21:22:36 UTC, Ali Çehreli wrote:
On 03/04/2013 12:06 PM, Andrea Fontana wrote:
If I understand it correctly something like:
range.filter!(...).map!(...)
browse range 2 times, one for filter and one for mapping
doesn't it?
Is there a way to "parallelize" this kind of operations?
std.parallelism has lots of cool features to help with range
parallelization. Here is map:
http://dlang.org/phobos/std_parallelism.html#.TaskPool.map
There are some examples of mine at
http://ddili.org/ders/d.en/parallelism.html
Here is an excerpt from the Summary section at that link:
- parallel() executes the iterations of foreach loops in
parallel.
- asyncBuf() iterates the elements of an InputRange
semi-eagerly in parallel.
- map() calls functions with the elements of an InputRange
semi-eagerly in parallel.
- amap() calls functions with the elements of a
RandomAccessRange fully-eagerly in parallel.
- reduce() makes calculations over the elements of a
RandomAccessRange in parallel.
Ali
Of course I used "parallelism" (with quotes) but i mean something
like "interleaving" as guessed by Timon Gehr.