RFR: 8352075: Perf regression accessing fields [v3]

Radim Vansa rvansa at openjdk.org
Mon May 5 06:30:49 UTC 2025


On Wed, 30 Apr 2025 20:12:17 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Fix VerifyRawIndexesTest
>>  - Fix reordering in layout and annotations
>>  - Use qsort_r for different platforms
>
> src/hotspot/share/oops/fieldInfo.hpp line 223:
> 
>> 221: };
>> 222: 
>> 223: #define JUMP_TABLE_STRIDE 16
> 
> How was the threshold of 16 determined?

I haven't done any benchmarks looking for the optimal value; this should balance the extra memory footprint vs. improved performance. Also I was hoping to not affect the bulk of Java code; rather optimize "big" classes that show degraded performance due to O(N) lookup.
How exactly could the optimization function look like if we're to weigh in both memory consumption and execution speed?

> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Field.java line 115:
> 
>> 113:     int numFields = numJavaFields + numInjectedFields;
>> 114:     // JumpTable is generated only for classes with > 16 (non-injected) fields
>> 115:     if (numJavaFields > 16) {
> 
> The test should use the `JUMP_TABLE_STRIDE` constant.

Sure, I can isolate this into static final var, though since this is Java code I can't really take the value from the macro.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24847#discussion_r2072899071
PR Review Comment: https://git.openjdk.org/jdk/pull/24847#discussion_r2072899858


More information about the serviceability-dev mailing list