JDK-8352891 Performance improvements to ByteArrayOutputStream
Engebretson, John
jengebr at amazon.com
Mon Apr 7 12:35:44 UTC 2025
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 <core-libs-dev-retn at openjdk.org> On Behalf Of Brian Burkhalter
Sent: Friday, April 4, 2025 3:31 PM
To: core-libs-dev at openjdk.org
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 <Alan.Bateman at oracle.com<mailto:Alan.Bateman at oracle.com>> wrote:
[…] and whether having a parameter to specify the initial size or some hint of the max size would help the discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250407/bf10ec5e/attachment-0001.htm>
More information about the core-libs-dev
mailing list