<i18n dev> RFR: 8345668: ZoneOffset.ofTotalSeconds performance regression [v3]

Chen Liang liach at openjdk.org
Sat Dec 21 01:02:35 UTC 2024


On Sat, 21 Dec 2024 00:54:34 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed compile error
>
> test/micro/org/openjdk/bench/java/time/ZoneOffsetBench.java line 49:
> 
>> 47:     public void ofTotalSeconds() {
>> 48:         for (int i = 0; i < 1_000; i++) {
>> 49:             ZoneOffset.ofTotalSeconds(0);
> 
> This benchmark method should accept a `Blackhole`, and the return value of `ofTotalSeconds` must be sent to the `Blackhole.consume` method.

This benchmark currently works probably because the cache interactions in `ofTotalSeconds`, which means JIT compilation cannot prove it is side-effect free.  Had it been as simple as a decimal computation or if the cache becomes a stable map, JIT compilation can eliminate the static factory method call entirely, and the benchmark would be measuring the performance of no-op invocation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22854#discussion_r1894523813


More information about the i18n-dev mailing list