On Thu, 19 Jun 2025 10:53:14 GMT, Markus KARG <d...@openjdk.org> wrote:
>>> Is there a reason for this pre-allocation? >> >> What would you suggest? Start with a smaller allocation and increase it if >> needed? There is no possibility of knowing the length of the stream. > > As this PR explicitly targets performance and as the aim of this method is to > keep **all** content in-memory anyways, I wonder if it would be acceptable > and even faster to pre-allocate `new StringBuilder(TRANSFER_BUFFER_SIZE)`? In > the end, this allocation is just temporary. My suggestion is to call `new StringBuilder(0)` as it is possible this is completely unused because we always hit the `eol && sb.length() == 0` path below. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2159289340