Drop Arrays.parallelStream()?
David M. Lloyd
david.lloyd at redhat.com
Mon Apr 22 06:42:51 PDT 2013
On 04/20/2013 05:38 PM, Brian Goetz wrote:
>> For most folks, the expectation and intuition will be sequential, so
>> take advantage of that: Let people come to c.stream().parallel() slowly
>> and deliberately, after getting their feet wet with c.stream().
>
> I have a slightly different viewpoint about the value of this sequential
> intuition -- I view the pervasive "sequential expectation" as one if the
> biggest challenges of this entire effort; people are *constantly*
> bringing their incorrect sequential bias, which leads them to do stupid
> things like using a one-element array as a way to "trick" the "stupid"
> compiler into letting them capture a mutable local, or using lambdas as
> arguments to map that mutate state that will be used during the
> computation (in a non-thread-safe way), and then, when its pointed out
> that what they're doing, shrug it off and say "yeah, but I'm not doing
> it in parallel."
>
> We've made a lot of design tradeoffs to merge sequential and parallel
> streams. The result, I believe, is a clean one and will add to the
> library's chances of still being useful in 10+ years, but I don't
> particularly like the idea of encouraging people to think this is a
> sequential library with some parallel bags nailed on the side.
Well, just the term "stream" really screams "sequential", so there's that.
--
- DML
More information about the lambda-libs-spec-observers
mailing list