Skip to content

Conversation

@trevorkbond
Copy link

@trevorkbond trevorkbond commented Nov 21, 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

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8350938: ResourceParsingClassHierarchyResolver inflates all Utf8 CP entries (Enhancement - P5)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28458/head:pull/28458
$ git checkout pull/28458

Update a local copy of the PR:
$ git checkout pull/28458
$ git pull https://git.openjdk.org/jdk.git pull/28458/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28458

View PR using the GUI difftool:
$ git pr show -t 28458

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28458.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2025

👋 Welcome back trevorkbond! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

@trevorkbond The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2025

Webrevs

@dansmithcode
Copy link

I'm available as a sponsor when we get this reviewed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants