Integrated: 8196106: Support nested infinite or recursive flat mapped streams
Viktor Klang
vklang at openjdk.org
Tue Apr 16 11:13:05 UTC 2024
On Thu, 4 Apr 2024 12:18:07 GMT, Viktor Klang <vklang at openjdk.org> wrote:
> This PR implements Gatherer-inspired encoding of `flatMap` that shows that it is both competitive performance-wise as well as improve correctness.
>
> Below is the performance of `Stream::flatMap` (for reference types):
>
> Before this PR (on my MacBook, aarch64):
>
> Non-short-circuiting:
>
> Benchmark (size) Mode Cnt Score Error Units
> FlatMap.par_array 10 thrpt 12 257582,480 ? 31360,242 ops/s
> FlatMap.par_array 100 thrpt 12 55202,015 ? 14011,668 ops/s
> FlatMap.par_array 1000 thrpt 12 6546,252 ? 3675,764 ops/s
> FlatMap.par_doublestream 10 thrpt 12 267423,410 ? 37338,089 ops/s
> FlatMap.par_doublestream 100 thrpt 12 27140,703 ? 4979,878 ops/s
> FlatMap.par_doublestream 1000 thrpt 12 2978,178 ? 1890,250 ops/s
> FlatMap.par_intstream 10 thrpt 12 268194,530 ? 37295,092 ops/s
> FlatMap.par_intstream 100 thrpt 12 30897,034 ? 5388,245 ops/s
> FlatMap.par_intstream 1000 thrpt 12 3969,043 ? 2494,641 ops/s
> FlatMap.par_longstream 10 thrpt 12 279756,861 ? 19519,497 ops/s
> FlatMap.par_longstream 100 thrpt 12 45733,955 ? 18385,144 ops/s
> FlatMap.par_longstream 1000 thrpt 12 5115,615 ? 4147,237 ops/s
> FlatMap.seq_array 10 thrpt 12 2937192,934 ? 58605,583 ops/s
> FlatMap.seq_array 100 thrpt 12 41859,462 ? 139,021 ops/s
> FlatMap.seq_array 1000 thrpt 12 442,677 ? 1,041 ops/s
> FlatMap.seq_doublestream 10 thrpt 12 4972651,093 ? 35997,267 ops/s
> FlatMap.seq_doublestream 100 thrpt 12 99265,005 ? 193,497 ops/s
> FlatMap.seq_doublestream 1000 thrpt 12 1037,030 ? 3,254 ops/s
> FlatMap.seq_intstream 10 thrpt 12 5133751,888 ? 23516,294 ops/s
> FlatMap.seq_intstream 100 thrpt 12 145166,206 ? 399,263 ops/s
> FlatMap.seq_intstream 1000 thrpt 12 1565,004 ? 3,207 ops/s
> FlatMap.seq_longstream 10 thrpt 12 5047029,363 ? 24742,300 ops/s
> FlatMap.seq_longstream 100 thrpt 12 233225,307 ? 7162,604 ops/s
> FlatMap.seq_longstream 1000 thrpt 12 2999,926 ? 9,945 ops/s
>
> // Short-circuiting:
>
> Benchmark (size) Mode Cnt Score Error Units
> FlatMap.par_iterate_double 10 thrpt 12 46336,834 ? 6803,751 ops/s
> FlatMap.par_iterate_double 100 thrpt 12 15365,884 ? 2750,656 ops/s
> FlatMap.par_iterate_double 1000 ...
This pull request has now been integrated.
Changeset: 8a5b86c5
Author: Viktor Klang <vklang at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/8a5b86c52954f6917acfda11df183691beb07f56
Stats: 609 lines in 9 files changed: 422 ins; 69 del; 118 mod
8196106: Support nested infinite or recursive flat mapped streams
Reviewed-by: psandoz
-------------
PR: https://git.openjdk.org/jdk/pull/18625
More information about the core-libs-dev
mailing list