<i18n dev> RFR: 8365186: Reduce size of j.t.f.DateTimePrintContext::adjust
Volkan Yazici
vyazici at openjdk.org
Sat Aug 9 05:17:55 UTC 2025
On Tue, 5 Aug 2025 01:23:17 GMT, Shaojin Wen <swen 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.
Would you mind sharing the details about the performance improvement you observed, please? On which platforms? Using which benchmarks? (Any in `test/micro/org/openjdk/bench/java/time/format`?)
Using 99425bc, I can observe a noteworthy improvement on all tested platforms:
| Benchmark | Linux aarch64 | Linux x64 | MacOSX aarch64 | MacOSX x64 | Windows x64 |
| --------- |:-------------:|:---------:|:--------------:|:----------:|:-----------:|
| DateTimeFormatterBench.formatInstants-pattern:HH_mm_ss | 0.75% | 7.33% | 7.60% | 8.30% | 9.16% |
| DateTimeFormatterBench.formatInstants-pattern:HH_mm_ss_SSS | 1.13% | 0.74% | 10.24% | 4.03% | -2.67% |
| DateTimeFormatterBench.formatInstants-pattern:yyyy_MM_ddTHH_mm_ss | 0.17% | 14.31% | 9.00% | 13.69% | 18.66% |
| DateTimeFormatterBench.formatInstants-pattern:yyyy_MM_ddTHH_mm_ss_SSS | -0.66% | 3.26% | 5.98% | 2.91% | -1.12% |
| DateTimeFormatterBench.formatZonedDateTime-pattern:HH_mm_ss | 5.17% | 6.54% | -1.61% | 1.55% | 7.25% |
| DateTimeFormatterBench.formatZonedDateTime-pattern:HH_mm_ss_SSS | 3.99% | 1.45% | 4.14% | 1.79% | 1.36% |
| DateTimeFormatterBench.formatZonedDateTime-pattern:yyyy_MM_ddTHH_mm_ss | 2.13% | 15.56% | -2.01% | 2.72% | 17.47% |
| DateTimeFormatterBench.formatZonedDateTime-pattern:yyyy_MM_ddTHH_mm_ss_SSS | 2.41% | 1.54% | 1.43% | 2.29% | 1.61% |
| DateTimeFormatterWithPaddingBench.formatWithPadding | 0.88% | 2.52% | 16.97% | 3.91% | 1.30% |
| DateTimeFormatterWithPaddingBench.formatWithPaddingLengthOne | -0.80% | 6.28% | 3.21% | 5.32% | 6.09% |
| DateTimeFormatterWithPaddingBench.formatWithPaddingLengthZero | 4.87% | 3.11% | 31.32% | 11.31% | 4.12% |
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26633#issuecomment-3154162461
PR Comment: https://git.openjdk.org/jdk/pull/26633#issuecomment-3167557811
More information about the i18n-dev
mailing list