[External] : Gatherer and primitive specialization

Viktor Klang viktor.klang at oracle.com
Thu Jun 13 10:52:03 UTC 2024


Hi Rémi,

Given that Collector has not been specialized since it was introduced, we opted to not specialize Gatherer eagerly as Valhalla Value Classes may also move the needle a bit regarding the need for specialization in general.

It was also not clear how far to take such specialization―since Gatherers have both input types and output types, should they be specialized in two axes or only one?

It also has implications on composition of Gatherers.

Cheers,
√


Viktor Klang
Software Architect, Java Platform Group
Oracle
________________________________
From: Remi Forax <forax at univ-mlv.fr>
Sent: Thursday, 13 June 2024 10:16
To: core-libs-dev <core-libs-dev at openjdk.java.net>
Cc: Viktor Klang <viktor.klang at oracle.com>
Subject: [External] : Gatherer and primitive specialization

Hello,
the Gatherer API do not provide primitive specialization while intermediate methods like map(), flatMap() or mapMulti() do.

Unlike collectors where it is okay to not be specialized because most collectors mutate a collection that is not specialized too,
gatherers can process/transform values so having boxing in the middle of those kind of computations is a performance pothole.

I think there is a trick that can be used, we do not need to specialize all the functions of the Gatherer API but only the integrator.
All other functions are called a few time when a stream is processed so they may not need specialization, only the integrator is called a lot.

regards,
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240613/0ebbf9fa/attachment.htm>


More information about the core-libs-dev mailing list