RFR: 8341566: Add Reader.of(CharSequence) [v7]
Markus KARG
duke at openjdk.org
Thu Oct 10 05:50:15 UTC 2024
On Wed, 9 Oct 2024 19:14:06 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/io/StringReader.java line 38:
>>
>>> 36: * {@code Reader.of(String)} should generally be used in preference to this one,
>>> 37: * as it supports all of the same operations but it is faster, as it performs no
>>> 38: * synchronization.
>>
>> Consider how this API note will age gracefully in a few releases.
>> I'd lead with the link to the new method and mention it is unsynchronized/single-thread safe.
>> The comments about performance and "better" belong in the release note.
>> Uncontested locks will be barely noticeable from a performance perspective.
>
> Currently uncontested locks have a performance regression after the removal of biased locking: A similar example with `StringBuffer` is available in #19513.
I do not have any personal preferences here. The text was paraphrased from `StringBuilder`, so it seems it was acceptable in the past. If a different text is wanted, I would kindly ask all participants in this discussion to agree upon one common proposal, as I personally am fine with the text as-is.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1794702589
More information about the core-libs-dev
mailing list