-
Enhancement
-
Resolution: Fixed
-
P4
-
16, 17
-
b17
-
x86
We have new j.l.Math JMH here: https://github.com/openjdk/jmh-jdk-microbenchmarks/blob/master/micros-jdk11/src/main/java/org/openjdk/bench/java/lang/MathBench.java
We discovered a funny "regression" with plain sqrt.
vsqrtsd 0x50(%r10),%xmm0,%xmm0
17-b12:
Benchmark Mode Cnt Score Error Units
MathBench.sqrtDouble thrpt 12 94635.738 ± 47.086 ops/ms
StrictMathBench.sqrtDouble thrpt 12 94652.203 ± 10.816 ops/ms
I added another case:
@Benchmark
public double sqrtDoubleAfterAdd() {
return Math.sqrt(double81 + double4Dot1);
}
So the double add result would be at hand into the sqrt, now we get
1.22% ││ 0x00007ff2d93e85d7: vmovsd 0x50(%r10),%xmm0
1.51% ││ 0x00007ff2d93e85dd: vaddsd 0x40(%r10),%xmm0,%xmm0
1.93% ││ 0x00007ff2d93e85e3: vsqrtsd %xmm0,%xmm0,%xmm0 ;*invokestatic sqrt {reexecute=0 rethrow=0 return_oop=0}
and the performance goes UP!
Benchmark Mode Cnt Score Error Units
MathBench.sqrtDouble thrpt 4 94649.452 ± 40.929 ops/ms
MathBench.sqrtDoubleAfterAdd thrpt 4 210876.199 ± 163.751 ops/ms
We discovered a funny "regression" with plain sqrt.
vsqrtsd 0x50(%r10),%xmm0,%xmm0
17-b12:
Benchmark Mode Cnt Score Error Units
MathBench.sqrtDouble thrpt 12 94635.738 ± 47.086 ops/ms
StrictMathBench.sqrtDouble thrpt 12 94652.203 ± 10.816 ops/ms
I added another case:
@Benchmark
public double sqrtDoubleAfterAdd() {
return Math.sqrt(double81 + double4Dot1);
}
So the double add result would be at hand into the sqrt, now we get
1.22% ││ 0x00007ff2d93e85d7: vmovsd 0x50(%r10),%xmm0
1.51% ││ 0x00007ff2d93e85dd: vaddsd 0x40(%r10),%xmm0,%xmm0
1.93% ││ 0x00007ff2d93e85e3: vsqrtsd %xmm0,%xmm0,%xmm0 ;*invokestatic sqrt {reexecute=0 rethrow=0 return_oop=0}
and the performance goes UP!
Benchmark Mode Cnt Score Error Units
MathBench.sqrtDouble thrpt 4 94649.452 ± 40.929 ops/ms
MathBench.sqrtDoubleAfterAdd thrpt 4 210876.199 ± 163.751 ops/ms
- relates to
-
JDK-8264557 Incorrect copyright year for test/micro/org/openjdk/bench/java/lang/MathBench.java after JDK-8264054
-
- Resolved
-