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

Naoto Sato naoto at openjdk.org
Thu Jan 2 17:56:36 UTC 2025


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

>> 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.

I decided to remove this benchmark, as the fix is merely to revert the previous fix and not providing any performance improvement (to the original).

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

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


More information about the i18n-dev mailing list