On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang <vkl...@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 ...
>
> Viktor Klang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Adding additional, short-circuit-specific, cases to the FlatMap benchmark

Very nice work.

-------------

Marked as reviewed by psandoz (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18625#pullrequestreview-1998504550

Reply via email to