unrdered()

Brian Goetz brian.goetz at oracle.com
Wed Apr 3 20:00:09 PDT 2013


Oops, wrong list -- damn auto-fill.

On 4/3/2013 10:34 PM, Brian Goetz 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.
>
>
>
>


More information about the lambda-dev mailing list