RFR: 8341566: Add Reader.of(CharSequence) [v7]

Chen Liang liach at openjdk.org
Wed Oct 9 19:18:27 UTC 2024


On Wed, 9 Oct 2024 18:56:19 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - assertThrows instead of expectedExceptions
>>  - ordered jtreg tags according recommendation in https://openjdk.org/jtreg/tag-spec.html#ORDER
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1794095812


More information about the core-libs-dev mailing list