<i18n dev> RFR: 8365186: Reduce size of j.t.f.DateTimePrintContext::adjust
Shaojin Wen
swen at openjdk.org
Sat Aug 9 05:17:56 UTC 2025
On Wed, 6 Aug 2025 09:20:30 GMT, Stephen Colebourne <scolebourne at openjdk.org> wrote:
>> By adding the JVM startup parameters `-XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining` and analyzing the printed log information, and found that the code size of the j.t.f.DateTimePrintContext::adjust method is 382, which is greater than 325, causing inlining failure.
>>
>>
>> @ 7 java.time.format.DateTimePrintContext::adjust (382 bytes) failed to inline: hot method too big
>>
>>
>> By splitting the code into `common/uncommon`, and moving the uncommon code into adjust0, the adjust method is kept small and can be inlined by the C2 optimizer.
>
> src/java.base/share/classes/java/time/format/DateTimePrintContext.java line 152:
>
>> 150: return chrono.zonedDateTime(Instant.from(temporal), overrideZone);
>> 151: }
>> 152: }
>
> Have you tested the split at different locations? I would expect line 143 or line 130 to perform best. There may be a case for splitting multiple times. You will also need a comment to indicate why the method is split.
In theory, the smaller the method, the greater the opportunity for performance improvement, but in DateTimeFormatterWithPaddingBench and DateTimeFormatterBench, the improvement is the same.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26633#discussion_r2256949893
More information about the i18n-dev
mailing list