RFR: 8196106: Support nested infinite or recursive flat mapped streams

Viktor Klang vklang at openjdk.org
Fri Apr 12 08:51:43 UTC 2024


On Mon, 8 Apr 2024 16:47:24 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> @PaulSandoz @AlanBateman I've added a commit to this PR which removes the use of Gatherer for Stream::flatMap, but instead implements flatMap for all of the pipelines using the same encoding which Gatherer would use. It seems very competitive performance-wise, and resolves at least one open JBS-issue with flatMap (will look to see if it resolves more than that)
>
>> @PaulSandoz @AlanBateman I've added a commit to this PR which removes the use of Gatherer for Stream::flatMap, but instead implements flatMap for all of the pipelines using the same encoding which Gatherer would use. It seems very competitive performance-wise, and resolves at least one open JBS-issue with flatMap (will look to see if it resolves more than that)
> 
> That's a rather clever use of `allMatch`!
> 
> Did you observe performance improvements using `@Stable` on the `cancel` field? It's really hard to predict in the abstract (since the default value of the field will be read in proportion to the number of elements until the stream is cancelled).

@PaulSandoz @AlanBateman This should be ready for review now, if you find some time :)

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

PR Comment: https://git.openjdk.org/jdk/pull/18625#issuecomment-2051317333


More information about the core-libs-dev mailing list