David Simcha's std.parallelism [questions for Walter]

dsimcha dsimcha at yahoo.com
Sun Jan 2 10:45:52 PST 2011


== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> On 1/2/11 10:39 AM, dsimcha wrote:
> > On 1/1/2011 6:07 PM, Andrei Alexandrescu wrote:
> >> * parallel is templated on range, but not on operation. Does this affect
> >> speed for brief operations (such as the one given in the example,
> >> squares[i] = i * i)? I wonder if using an alias wouldn't be more
> >> appropriate. Some performance numbers would be very useful in any case.
> >
> > Will benchmark, though the issue here is that I like the foreach syntax
> > and this can't be done with templates as you describe. Also, IIRC (I'll
> > do the benchmark at some point to be sure) for such examples memory
> > bandwidth is limiting, so the delegate call doesn't matter anyhow.
> I think anyone who wants to run something in parallel is motivated
> primarily by increasing efficiency, so focusing on aesthetics would be
> secondary and unsatisfactory for your target audience.

Ok, next questions, and things I've wanted clarified for a while:

1.  How are template alias parameters that reference variables in local scope
going to work once fully debugged?  There's a laundry list of Bugzilla issues
related to such aliases and the spec isn't very clear.

2.  As I'd strongly prefer to keep the foreach syntax, will opApply ever be
allowed to work with an alias instead of a delegate?  I ask because I was reading
the DMD source code a while back and saw this feature half implemented.  If so,
I'll just leave it alone for now and switch to an alias when this is implemented.


More information about the Digitalmars-d mailing list