unrdered()
Joe Bowbeer
joe.bowbeer at gmail.com
Thu Apr 4 06:01:09 PDT 2013
Consider making forEach ordered by default, and relying on unordered() to
disable this.
On Apr 3, 2013 10:00 PM, "Brian Goetz" <brian.goetz at oracle.com> wrote:
> At one point, we had an unordered() op. I think it may be time to bring
> it back.
>
> There are a growing number of ops that have optimized implementations for
> unordered streams:
>
> - distinct can be implemented with concurrent insertion into a CHS
> instead of merging if we don't care about order. Not only is this less
> work (merging is expensive), but it makes distinct lazy (elements can flow
> through immediately once they've not been found in the CHS, instead of
> waiting for all the elements to be seen.)
>
> - sorted is non-stable in unordered streams.
>
> - limit/subsequence are far lighter for unordered streams (and can
> similarly be made lazy)
>
> So a way of saying "I know you think this stream has ordering, but I don't
> care about it" is a way of opting into these optimizations.
>
> Implementation is trivial.
>
> Adding .unordered() could also enable us to get rid of
> .collectUnordered(), and allow more of the reduce-like ops to benefit from
> the embrace of "disorder" without API explosion.
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130404/9e7eb177/attachment.html
More information about the lambda-libs-spec-experts
mailing list