Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308773

[AArch64] Math.pow is 30% slower than StrictMath.pow on linux-aarch64

XMLWordPrintable

    • aarch64
    • linux

      The classjava.lang.Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. The numeric methods of class java.lang.StrictMath are defined to return the bit-for-bit same results on all platforms. The implementations of the equivalent functions in class java.lang.Math do not have this requirement. This relaxation permits better-performing implementations where strict reproducibility is not required. By default most of the java.lang.Math methods simply call the equivalent method in java.lang.StrictMath for their implementation. Code generators (like C2) are encouraged to use platform-specific native libraries or microprocessor instructions, where available, to provide higher-performance implementations of java.lang.Math methods. Such higher-performance implementations still must conform to the specification for java.lang.Math

      Running JMH benchmarks show that Math.pow is 30% slower than StrictMath.pow on linux-aarch64.

      To reproduce:
      cp BenchmarkMath.java test/micro
      CONF=linux-aarch64 make build-microbenchmark
      CONF=linux-aarch64 make TEST="micro:BenchmarkMath"

      Benchmark Mode Cnt Score Error Units
      Math.pow thrpt 5 213262.312 ± 1038.459 ops/ms
      StrictMath.pow thrpt 5 299059.559 ± 417.897 ops/ms
      Finished running test 'micro:BenchmarkMath'

      See also JDK-8308776, JDK-8308775, JDK-8308774, JDK-8308773.

            Unassigned Unassigned
            tholenstein Tobias Holenstein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: