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

Brian Burkhalter bpb at openjdk.org
Tue Apr 11 01:30:35 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.

Based on further measurements it is unclear whether this change has any significant benefit when the `CharSequence` is a `String` or a `StringBuffer`. Presumably this is due to some combination of caching, copying, and intrinsics. When the source is a `StringBuilder`, however, the performance improvement looks to be more that 300%.

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

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


More information about the nio-dev mailing list