RFR: 8305811: (bf) Improve heap buffer performance of CharBuffer::append(CharSequence)

ExE Boss duke at openjdk.org
Tue Apr 11 18:21:33 UTC 2023


On Tue, 11 Apr 2023 00:11:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Use the `getChars` method of `String`, `StringBuffer`, and `StringBuilder` to load the chars directly into the array of the heap buffer.

I think it comes down to the fact that `StringBuffer::toString()` uses the `String` constructor which deduplicates the underlying `String.value` array, whereas `StringBuilder::toString()` always performs the array copy.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13415#issuecomment-1503876445


More information about the nio-dev mailing list