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 <fo...@univ-mlv.fr> Sent: Thursday, 13 June 2024 10:16 To: core-libs-dev <core-libs-...@openjdk.java.net> Cc: Viktor Klang <viktor.kl...@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