On Fri, 18 Apr 2025 02:26:10 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - 8354724: Increment copyright year in Reader >> - 8354724: Move readString from BufferedReader to Reader > > src/java.base/share/classes/java/io/Reader.java line 424: > >> 422: int n; >> 423: while ((n = read(str)) != -1) { >> 424: result.append(str, 0, n); > > If the characters in the Reader are always Latin1, this process will convert > the UTF16 char[] to the LATIN1 encoded byte[] value in the StringBuilder > every time, which will cause unnecessary performance overhead. We need to provide a StringBuilder that creates a coder of UTF16 to avoid the unnecessary UTF16 to LATIN1 conversion overhead here. If we do not want to add a new public method, we can add an internal method and expose it through JLA for use here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2049921890