On Thu, Jan 6, 2011 at 10:05 AM, Kevin Wright <[email protected]>wrote:

> >
> > This seems wrong. Just because the loop seems to be parallelizable
> doesn't mean it is. The compiler needs to know whether your iteration is
> ordering sensitive or not ("Is it okay if index 3 is treated before index
> 1?"). This hint is much more meaningful than whether the developer is using
> an index of foreach. The same applies to closures, LINQ or whatever
> comprehension walking mechanism you favor.
>
> If you have referential integrity (the same function, with the same input
> always returns the same value, immutability is important here) and the
> functions have no side-effects (e.g println) then it's mathematically
> guaranteed that ordering won't matter.  You can still have indices, they
> just don't need to be processed in-order.
>
Imagine a loop that calculates the product of several matrices stored in an
array. This operation satisfies all your requirements, yet the loop is not
parallelizable.

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to