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

[AArch64] Math.pow is 27% slower than StrictMath.pow on macosx-aarch64

    XMLWordPrintable

Details

    • aarch64
    • os_x

    Description

      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 shows that Math.pow is 27% slower than StrictMath.pow on macosx-aarch64

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

      Benchmark Mode Cnt Score Error Units
      Math.pow thrpt 5 356151.695 ± 6446.919 ops/ms
      StrictMath.pow thrpt 5 485949.306 ± 3558.230 ops/ms

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: