<div dir="auto"><div>Thanks for your feedback and for making me aware of the complications around Gatherers.</div><div dir="auto"><br></div><div dir="auto">I will also put more thought into how this could work for Gatherers.</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2025, 23:31 Viktor Klang <<a href="mailto:viktor.klang@oracle.com" target="_blank" rel="noreferrer">viktor.klang@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Indeed. I hope I didn't sound discouraging about the possibility to propagate the stream size information.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I merely want to emphasize that it may necessitate a slightly broader take on the problem of propagation of stream-instance metadata, especially in the face of Gatherers becoming a finalized feature.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
It's great that you started this conversation, Fabian!</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_6408984439748996531m_2954459722449792725Signature" style="color:inherit">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Cheers,<br>
√</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<b><br>
</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<b>Viktor Klang</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<div id="m_6408984439748996531m_2954459722449792725appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_6408984439748996531m_2954459722449792725divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> core-libs-dev <<a href="mailto:core-libs-dev-retn@openjdk.org" rel="noreferrer noreferrer" target="_blank">core-libs-dev-retn@openjdk.org</a>> on behalf of Paul Sandoz <<a href="mailto:paul.sandoz@oracle.com" rel="noreferrer noreferrer" target="_blank">paul.sandoz@oracle.com</a>><br>
<b>Sent:</b> Thursday, 13 February 2025 20:18<br>
<b>To:</b> Fabian Meumertzheim <<a href="mailto:fabian@buildbuddy.io" rel="noreferrer noreferrer" target="_blank">fabian@buildbuddy.io</a>><br>
<b>Cc:</b> core-libs-dev <<a href="mailto:core-libs-dev@openjdk.org" rel="noreferrer noreferrer" target="_blank">core-libs-dev@openjdk.org</a>><br>
<b>Subject:</b> Re: JDK-8072840: Presizing for Stream Collectors</font>
<div> </div>
</div>
<div><font size="2"><span style="font-size:11pt">
<div>Hi Fabian,<br>
<br>
Thanks for sharing and reaching out with the idea before getting too beholden to it.<br>
<br>
I logged this is quite a while ago. It seemed like a possible good idea at the time, although I never liked the duplication of suppliers. I have become less enthusiastic overtime, especially so as Gatherers have been added. (Gatherer is the underlying primitive
 we could not find when we were furiously developing streams and meeting the Java 8 deadline.) My sense is if we are going to address we need to think more broadly about Gatherers. And, Viktor being the lead on Gatherers has a good take on where this might
 head.<br>
<br>
Paul.<br>
<br>
> On Feb 12, 2025, at 2:09 AM, Fabian Meumertzheim <<a href="mailto:fabian@buildbuddy.io" rel="noreferrer noreferrer" target="_blank">fabian@buildbuddy.io</a>> wrote:<br>
> <br>
> As an avid user of Guava's ImmutableCollections, I have been<br>
> interested in ways to close the efficiency gap between the built-in<br>
> `Stream#toList()` and third-party `Collector` implementations such as<br>
> `ImmutableList#toImmutableList()`. I've found the biggest problem to<br>
> be the lack of sizing information in `Collector`s, which led to me to<br>
> draft a solution to JDK-8072840:<br>
> <a href="https://github.com/openjdk/jdk/pull/23461" rel="noreferrer noreferrer" target="_blank">https://github.com/openjdk/jdk/pull/23461</a><br>
> <br>
> The benchmark shows pretty significant gains for sized streams that<br>
> mostly reshape data (e.g. slice records or turn a list into a map by<br>
> associating keys), which I've found to be a pretty common use case.<br>
> <br>
> Before I formally send out the PR for review, I would like to gather<br>
> feedback on the design aspects of it (rather than the exact<br>
> implementation). I will thus leave it in draft mode for now, but<br>
> invite anyone to comment on it or on this thread.<br>
> <br>
> Fabian<br>
<br>
</div>
</span></font></div>
</div>

</blockquote></div>
</div></div>