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

Crypto AES/ECB encryption/decryption performance regression (introduced in jdk9b73)

    Details

    • Subcomponent:
    • Introduced In Build:
      b70
    • Resolved In Build:
      b03
    • CPU:
      x86
    • OS:
      generic

      Backports

        Description

        Modifications done by https://bugs.openjdk.java.net/browse/JDK-8076112 issue introduced performance regression for AES/ECB algorithm.

        Performance JDK9 became worse than JDK8 by 20%-28%.

        (data collected on Intel Core i5-5300U)

        jdk8 1.8.0_65-b17
        Benchmark (algorithm) (dataSize) (keyLength) (provider) Mode Cnt Score Error Units
        AESBench.decrypt AES/ECB/NoPadding 1024 128 thrpt 40 877361.121 ± 16739.704 ops/s
        AESBench.encrypt AES/ECB/NoPadding 1024 128 thrpt 40 1044189.005 ± 13780.381 ops/s

        jdk9b72
        Benchmark (algorithm) (dataSize) (keyLength) (provider) Mode Cnt Score Error Units
        AESBench.decrypt AES/ECB/NoPadding 1024 128 thrpt 240 824861.201 ± 6783.383 ops/s
        AESBench.encrypt AES/ECB/NoPadding 1024 128 thrpt 240 965084.477 ± 6624.554 ops/s

        jdk9b73
        Benchmark (algorithm) (dataSize) (keyLength) (provider) Mode Cnt Score Error Units
        AESBench.decrypt AES/ECB/NoPadding 1024 128 thrpt 240 733935.602 ± 3856.189 ops/s
        AESBench.encrypt AES/ECB/NoPadding 1024 128 thrpt 240 819966.663 ± 8685.148 ops/s

        The reason of the performance regression in adding range checks into com.sun.crypto.provider.AESCrypt.encryptBlock/decryptBlock methods and hotspot is unable to move out of loop this checks.

        Sugested fix: introduce methods encryptBlocks/decryptBlocks and move range checks out of loop manually.

        Results (on jdk10):
        jdk10(baseline)
        Benchmark (algorithm) (dataSize) (keyLength) (provider) Mode Cnt Score Error Units
        AESBench.decrypt AES/ECB/NoPadding 1024 128 thrpt 40 660722.552 ± 22153.323 ops/s
        AESBench.encrypt AES/ECB/NoPadding 1024 128 thrpt 40 699155.163 ± 61539.097 ops/s

        jdk10(fixed)
        Benchmark (algorithm) (dataSize) (keyLength) (provider) Mode Cnt Score Error Units
        AESBench.decrypt AES/ECB/NoPadding 1024 128 thrpt 40 939556.785 ± 9222.515 ops/s
        AESBench.encrypt AES/ECB/NoPadding 1024 128 thrpt 40 1141960.563 ± 11074.921 ops/s

        Suggested fix not only remove the regression, besides it gives small speedup and finally JDK10 is 7%-9% faster than JDK8.

        Suggested fix: http://cr.openjdk.java.net/~skuksenko/crypto/8179098/webrev.00/

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  valeriep Valerie Peng
                  Reporter:
                  skuksenko Sergey Kuksenko
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: