On Sun, 8 Sep 2024 07:52:26 GMT, Shaojin Wen <[email protected]> wrote:
> Similar to ObjectInputStream, use JLA.countPositives and
> JLA.inflateBytesToChars to speed up readUTF
src/java.base/share/classes/java/io/DataInputStream.java line 602:
> 600: int ascii = JLA.countPositives(bytearr, 0, utflen);
> 601: if (ascii == utflen) {
> 602: return new String(bytearr, 0, utflen,
> StandardCharsets.ISO_8859_1);
Maybe use `sun.nio.cs.ISO_8859_1.INSTANCE` instead in order to avoid
initialising unused charsets:
Suggestion:
return new String(bytearr, 0, utflen, ISO_8859_1.INSTANCE);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20903#discussion_r1749167163