RFR: 8339320: Optimize ClassFile Utf8EntryImpl#inflate
Chen Liang
liach at openjdk.org
Fri Aug 30 12:30:46 UTC 2024
On Thu, 29 Aug 2024 11:44:50 GMT, Shaojin Wen <swen at openjdk.org> wrote:
> A very small optimization, split the large method inflate, split the infrequently used paths into a method inflateCHAR
Java's UTF8 entry cannot use the 4-byte format in regular UTF8. You can check out how DataInputStream read UTF8 strings instead.
src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java line 402:
> 400: return JLA.regionMatches(s, rawBytes, LATIN1, offset, charLen);
> 401: } else {
> 402: return JLA.regionMatches(s, chars, UTF16, 0, charLen);
I think instead of making our internal representation complex to speed up this regionMatches, we should ask the VM side if they can provide a Java API for ArraysSupport.mismatch that operates on a byte array and a char array.
-------------
Changes requested by liach (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20767#pullrequestreview-2268548164
PR Review Comment: https://git.openjdk.org/jdk/pull/20767#discussion_r1736590160
More information about the core-libs-dev
mailing list