Brian, Alan, Markus, Chen – thank you for your feedback on this issue! At
this point we seem to agree that 1) there is merit to this idea, 2) nobody
loves a new public class (including me), and 3) this is not a subclass of
ByteArrayOutputStream. Are we ready to move this to CSR and continue the API
discussion there?
Thank you very much! 😊
John
From: Engebretson, John
Sent: Monday, April 7, 2025 7:36 AM
To: 'Brian Burkhalter' <[email protected]>; [email protected]
Subject: RE: [EXTERNAL] JDK-8352891 Performance improvements to
ByteArrayOutputStream
Thank you Brian, I’m sorry I missed this point! The hint in this case is the
parameter on the overloaded constructor; if set high enough, the
initially-allocated buffer will guarantee exactly one array allocation with no
growth. This is identical to the ByteArrayOutputStream behavior described on
[1].
However, both issues focus on the far more common case of not knowing the
final payload size, or perhaps making a bad guess; [1] attempts to modify the
scale while [2] rewrites the data structure for greater gain.
John
From: core-libs-dev
<[email protected]<mailto:[email protected]>> On
Behalf Of Brian Burkhalter
Sent: Friday, April 4, 2025 3:31 PM
To: [email protected]<mailto:[email protected]>
Subject: RE: [EXTERNAL] JDK-8352891 Performance improvements to
ByteArrayOutputStream
CAUTION: This email originated from outside of the organization. Do not click
links or open attachments unless you can confirm the sender and know the
content is safe.
I did not notice that Alan’s comment below, about adding a hint as to the
maximum expected size, has been specifically addressed anywhere in this
discussion. It might not be all that pertinent to the main thread of
discussion, however, but it would certainly be useful for the issue [1], which
I linked to [2].
Brian
[1] https://bugs.openjdk.org/browse/JDK-8329287
[2] https://bugs.openjdk.org/browse/JDK-8353729
On Apr 2, 2025, at 3:52 AM, Alan Bateman
<[email protected]<mailto:[email protected]>> wrote:
[…] and whether having a parameter to specify the initial size or some hint of
the max size would help the discussion.