RFR: 8154387 - Parallel unordered Stream.limit() tries to collect 128 elements even if limit is less

Paul Sandoz paul.sandoz at oracle.com
Tue Apr 19 16:57:36 UTC 2016

> On 19 Apr 2016, at 18:28, Tagir F. Valeev <amaembo at gmail.com> wrote:
> Hello!
> webrev is updated in-place (just added parentheses):
> http://cr.openjdk.java.net/~tvaleev/webrev/8154387/r1/
> Updated benchmark source and results are available here:
> http://cr.openjdk.java.net/~tvaleev/webrev/8154387/jmh/
> In general I observe that for low-Q filter (x -> true) the results are
> also improved as well as for
> -Djava.util.concurrent.ForkJoinPool.common.parallelism=1. My tests
> were performed on 4-core machine (no hyperthreading), thus default
> parallelism is 4.

Thanks, this looks good.

> The LEAF_TARGET version does not change the results significantly. If
> you feel that using LEAF_TARGET is more suitable I can update webrev
> correspondingly.

It has some appeal, since there is a symmetry to using that and the threshold at which the wrapping spliterator will no longer be split by F/J tasks. Up to you.


More information about the core-libs-dev mailing list