RFR: 8341566: Add Reader.of(CharSequence) [v11]
Rob Spoor
duke at openjdk.org
Mon Oct 14 20:04:14 UTC 2024
On Mon, 14 Oct 2024 19:27:00 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Revert 'inc should be faster than add on most CPUs'
>
> src/java.base/share/classes/java/io/Reader.java line 214:
>
>> 212: cbuf[off + i] = cs.charAt(next + i);
>> 213: }
>> 214: }
>
> Just a drive-by observation, not for this PR to handle:
>
> If four out of five `CharSequence` implementations in the JDK include fast-path methods for copying char ranges into an output buffer, perhaps it is time to introduce `CharSequence::getChars` as a default method?
>
> That way, code like this wouldn't need to special-case for the known fast-paths, and external implementations could also join the party.
That had been discussed here: https://github.com/openjdk/jdk/pull/21371#pullrequestreview-2350588453
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1800009004
More information about the core-libs-dev
mailing list