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

[linux] Poor StrictMath performance due to non-optimized compilation

XMLWordPrintable

    • b12
    • generic
    • linux

        Currently fdlibm optimization is disabled for x86_64 and x86 on linux. However, optimization has been turned on for ppc64/s390x/aarch64 linux via JDK-8170153 without losing precision.

        Testing showed that we can turn on optimization (-O3 and -ffp-contract=off) for fdlibm too and gain some performance:

        Before on x86_64:
        Function | java.lang.Math | java.lang.StrictMath
        ---------------------------------------------------------------------------------
        sin | 1.713649346570452 0m5.502s | 1.7136493465700542 0m33.382s
        cos | 0.17098435541810225 0m5.680s | 0.1709843554185943 0m31.562s
        tan | -5.5500322522995315E7 0m5.785s |-5.5500322522995315E7 0m33.657s
        atan | 1.5707961389886132E8 0m5.714s | 1.5707961389886132E8 0m5.714s
        log | 1.7420680845245087E9 0m2.329s | 1.7420680845245087E9 0m6.212s
        log10 | 7.565705562087342E8 0m2.313s | 7.565705562087342E8 0m7.946s
        sqrt | 6.66666671666567E11 0m0.436s | 6.66666671666567E11 0m0.481s
        cbrt | 3.481191648389617E10 0m5.325s | 3.481191648389617E10 0m5.295s
        tanh | 9.999999971990079E7 0m1.438s | 9.999999971990079E7 0m1.404s
        log1p | 1.7420681029451895E9 0m6.206s | 1.7420681029451895E9 0m6.457s
        IEEEremainder | 502000.0 0m10.828s | 502000.0 0m10.629s
        atan2 | 1.570453905253704E8 0m7.957s | 1.570453905253704E8 0m8.037s
        hypot | 5.000000099033372E15 0m2.313s | 5.000000099033372E15 0m2.171s

        After on x86_64:
        Function | java.lang.Math | java.lang.StrictMath
        ---------------------------------------------------------------------------------
        sin | 1.713649346570452 0m5.800s | 1.7136493465700542 0m18.731s
        cos | 0.17098435541810225 0m5.765s | 0.1709843554185943 0m18.796s
        tan | -5.5500322522995315E7 0m6.031s |-5.5500322522995315E7 0m21.093s
        atan | 1.5707961389886132E8 0m4.702s | 1.5707961389886132E8 0m4.902s
        log | 1.7420680845245087E9 0m2.321s | 1.7420680845245087E9 0m4.439s
        log10 | 7.565705562087342E8 0m2.263s | 7.565705562087342E8 0m5.543s
        sqrt | 6.66666671666567E11 0m0.427s | 6.66666671666567E11 0m0.449s
        cbrt | 3.481191648389617E10 0m5.261s | 3.481191648389617E10 0m5.214s
        tanh | 9.999999971990079E7 0m1.393s | 9.999999971990079E7 0m1.307s
        log1p | 1.7420681029451895E9 0m5.131s | 1.7420681029451895E9 0m5.131s
        IEEEremainder | 502000.0 0m6.061s | 502000.0 0m6.048s
        atan2 | 1.570453905253704E8 0m5.678s | 1.570453905253704E8 0m5.668s
        hypot | 5.000000099033372E15 0m2.112s | 5.000000099033372E15 0m2.147s

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: