RFR: 8350938: ResourceParsingClassHierarchyResolver inflates all Utf8 CP entries [v3]
Trevor Bond
duke at openjdk.org
Wed Nov 26 15:23:44 UTC 2025
> Enhance `ResourceParsingClassHierarchyResolver.getClassInfo` to use `ClassReaderImpl` to improve performance. Previously this method inflated and stored all UTF-8 entries in the constant pool and later accessed the array of strings to try finding the name of the superclass. `ClassReaderImpl` instead stores constant pool offsets and later lazily reads/inflates UTF8 entries as needed.
>
> I’ve ran all tier 1 tests and tests within `test/jdk/jdk/classfile` on the latest version of this change, and they all pass.
>
> I ran some informal performance testing to see if these changes led to any improvement. I created a .class file with several thousand unique strings in a String array to deliberately enlarge the number of UTF-8 entries in the constant pool. I then benchmarked the performance of running a process nearly identical to `ClassHierarchyInfoTest.testClassLoaderParsingResolver` on this custom class over 200 runs using JMH. The results are as follows.
>
> | Version | Avg Time (ns/op) | Δ vs Before |
> |--------|------------------:|-------------|
> | **Before** | 1,483,671.539 ± 3,477.744 | — |
> | **After** | 1,380,064.517 ± 3,482.434 | ≈ 7.0% faster |
Trevor Bond has updated the pull request incrementally with one additional commit since the last revision:
Update copyright years
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/28458/files
- new: https://git.openjdk.org/jdk/pull/28458/files/a990cd30..bbdf8bd3
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=28458&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=28458&range=01-02
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/28458.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28458/head:pull/28458
PR: https://git.openjdk.org/jdk/pull/28458
More information about the core-libs-dev
mailing list