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

SHA-3 Hash algorithm performance improvements (~12x speedup)

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: security-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b123
    • CPU:
      generic

      Description

      Performance of SHA3 (SUN Provider) Hash algorithm was checked.

      As result we got poor performance. It's 50% slower than alternative BouncyCastle java SHA3 implementation.
      Moreover, SHA3 implementation has shown very huge memory consumption. In average allocation rate is 400 bytes per byte of hashed mesage for SHA3-512 and 200 bytes per per byte of hashed mesage for SHA3-256.
      So calculating digest for 1Mb original data we got:
      Allocaton rate (SHA3-512) = 380 Mb/op (per means per a single digest invocation),
      Allocaton rate (SHA3-256) = 202 Mb/op.

      Here is performance results:

      Benchmark (algorithm) (dataSize) Score Error Units
      MessageDigestBench.digest SHA3-224 1048576 11.537 ± 0.059 ops/s
      MessageDigestBench.digest SHA3-256 1048576 11.088 ± 0.085 ops/s
      MessageDigestBench.digest SHA3-384 1048576 8.459 ± 0.079 ops/s
      MessageDigestBench.digest SHA3-512 1048576 5.851 ± 0.059 ops/s

      Suggested patch fully eliminates memory consumption. Allocation rate is ~871 bytes per digest invocation and doesn't depend on input data size.
      SHA3 performance was impoved by ~6x times:

      Benchmark (algorithm) (dataSize) Score Error Units
      MessageDigestBench.digest SHA3-224 1048576 62.418 ± 0.319 ops/s
      MessageDigestBench.digest SHA3-256 1048576 58.933 ± 0.575 ops/s
      MessageDigestBench.digest SHA3-384 1048576 44.358 ± 4.114 ops/s
      MessageDigestBench.digest SHA3-512 1048576 30.029 ± 3.492 ops/s

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: