review of std.parallelism

dsimcha dsimcha at yahoo.com
Sat Mar 19 16:38:57 PDT 2011


On 3/19/2011 7:33 PM, Daniel Gibson wrote:
> Am 19.03.2011 22:45, schrieb dsimcha:
>> IMHO all early termination that affects subsequent loop iterations as well
>> (break, goto, labeled break and continue, but not regular continue) should just
>> throw because they make absolutely no sense in a parallel context.
>
> What about some kind of parallel search? You just want to know if something is
> there and on first sight you're done, so you want to break out of this iteration
> and don't want any new parallel iterations to be done.
> (Not sure what should be done with currently running iterations.. should they be
> killed or go on until they're done - anyway, the executing thread shouldn't
> start a new iteration after that)

It's an interesting suggestion, and I'll give some thought to it, but on 
first glance it sounds **very** difficult to implement efficiently.  To 
avoid doing a lot of extra work after you've found what you need, you'd 
need to use very small work units.  To avoid excessive overhead you'd 
need to use fairly large work units.  The only case I can think of where 
this would be do-able is when evaluating the predicate is very expensive.


More information about the Digitalmars-d mailing list