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

Paul Sandoz psandoz at openjdk.org
Tue Apr 9 10:00:38 UTC 2024


On Mon, 8 Apr 2024 10:20:11 GMT, Viktor Klang <vklang 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)

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).

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

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


More information about the core-libs-dev mailing list