On Wed, 14 May 2025 19:44:56 GMT, Markus KARG <d...@openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Replace getChars in previous commit with subSequence > > src/java.base/share/classes/java/io/Reader.java line 206: > >> 204: ensureOpen(); >> 205: int len = cs.length(); >> 206: String result = cs.subSequence(next, len).toString(); > > Are you sure that `subSequence` is more efficient that `getChars`? Otherwise > I do not see why replacing it. I think this may be a good way to reduce redundant allocation if the CharSequence's subsequence is a simple view (frequently the case for user ones) or a String (for StringBuilder, String) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2089650320