On 12/27/2015 08:42 AM, Jay Norwood wrote:

> However, I was trying to use each!, with the intention of then moving to
> parallel processing by samples blocks. My guess is this would be more
> efficient than using parallel map or amap, which would parallel process
> by function application, if I understand correctly.

There is also taskPool.asyncBuf but it made your code on the other thread with apply_metrics() even slower.

> It isn't clear to me from the examples if something like below can be
> rewritten to use the chained calls.
>
> foreach(i, ref elem; taskPool.parallel(samples, 100))

parallel() returns struct ParallelForeach, which is not an InputRange. That limits its usefulness. However, each() seems to work with types that provide opApply() (which ParallelForeach does) and the following works (in some cases):

    some.range.chain.parallel.each!(/* ... */);

Ali

Reply via email to