RFR: 8269280: (bf) Replace StringBuffer in *Buffer.toString()
Aleksey Shipilev
shade at openjdk.java.net
Thu Jun 24 11:07:31 UTC 2021
On Thu, 24 Jun 2021 10:57:25 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> There is a StringBuffer use in X-Buffer template. The extra thread safety is not required there. In post-BiasedLocking times, this is gets worse, as every append is synchronized.
>>
>> Additional testing:
>> - [x] `java/nio/Buffer` tests, verified current `toString` output is unchanged
>
> src/java.base/share/classes/java/nio/X-Buffer.java.template line 1673:
>
>> 1671: + " lim=" + limit()
>> 1672: + " cap=" + capacity()
>> 1673: + "]";
>
> This looks okay. Is this a drive-by observation or is something really stressing Buffer::toString?
Viktor Klang made a drive-by observation here: https://twitter.com/viktorklang/status/1407688764567298052. I highly doubt it matters anywhere performance-wise, so I did no benchmarks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4581
More information about the nio-dev
mailing list