RFR: 8348638: Performance regression in Math.tanh [v7]
Mohamed Issa
duke at openjdk.org
Fri Apr 25 00:50:49 UTC 2025
On Thu, 24 Apr 2025 16:51:06 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> Mohamed Issa has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Make regular tanh benchmark inputs constant values
>
> test/micro/org/openjdk/bench/java/lang/MathBench.java line 67:
>
>> 65: public double double1 = 1.0d, double2 = 2.0d, double81 = 81.0d, doubleNegative12 = -12.0d, double4Dot1 = 4.1d, double0Dot5 = 0.5d;
>> 66:
>> 67: public static final double tanhConstInputs[] = {-2.0, -1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0};
>
> Static final arrays have mutable elements, you should declare individual static fields with different constant values.
> We can also use @Stable annotation, in that case array index must be a constant. Is better to go with few individual static final fields with constant values.
I switched to individual static final fields with constant values. There are separate micro-benchmarks included as well.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23889#discussion_r2059413513
More information about the hotspot-compiler-dev
mailing list