JDK-8338546 : Speed up ConstantPoolBuilder::classEntry(ClassDesc)
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-08-19
  • Updated: 2024-09-30
  • Resolved: 2024-09-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b17Fixed
Description
ConstantPoolBuilder.classEntry(ClassDesc) is having some troubles with ClassDesc: it currently computes a substring and finds the utf8, which involves a new allocation and hash calculation for both hits and misses. Both cases can be optimized.

Hit improvements:
1. Use new hashing scheme for ClassEntry so it can be derived from a ClassDesc. Fast return if ClassDesc matches. (This relies on the == fast path in ClassDesc to avoid array scans, assuming we share ClassDesc objects)

Miss improvements:
1. Derive utf8 hash from ClassDesc to avoid recomputation when looking up or putting into CP table
2. Avoid substringing until we confirm there's no matching utf8

Need to check the results to ensure there's no extra hashing or array scanning done as a regression from these improvements.

Comments
Changeset: caa751c5 Branch: master Author: Chen Liang <liach@openjdk.org> Date: 2024-09-24 14:28:05 +0000 URL: https://git.openjdk.org/jdk/commit/caa751c561f55bc59a6195a947d7b75515b5d2c0
24-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20667 Date: 2024-08-21 22:27:02 +0000
22-08-2024