Why is amap implemented as a member function of TaskPool?

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 22 00:48:10 PDT 2014


On Saturday, 20 September 2014 at 07:25:45 UTC, Russel Winder via 
Digitalmars-d-learn wrote:
> On Sat, 2014-09-20 at 06:46 +0000, "Nordlöw" via 
> Digitalmars-d-learn
> wrote:
>> On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves 
>> wrote:
>> > I had to roll my own parallel map today, but at least I did 
>> > get a nice 3x speedup.
>
> How many cores? Is the problem a data parallel one and hence 
> should show
> linear speedup?

It depends on the data. I was running analysis on a build 
dependency graph. It'd depend on the dependency tree topology. I 
have 4 cores with hyperthreading. 3x speedup seems good to me, 
especially since the implementation is recursive.

>
>> Is your own parallel map public somewhere? It would be 
>> interesting to see it.
>
> Particularly if it can be used to improved the code in 
> std.parallelism.

Now that I looked at the bug id referenced above, I don't think 
it'd help. I can see all sorts of problems with guaranteeing no 
mutable references are captured by the delegate.

Atila



More information about the Digitalmars-d-learn mailing list