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

Implement MD5 Intrinsics on x86

XMLWordPrintable

    • b10
    • x86, x86_64
    • generic

        The existing implementation of `sun.security.provider.MD5.implCompress` is done in Java. When compiled to native code, the generated code contains many Java-isms like array-bound checks. That hurts performance for an algorithm that can be used to validate large amounts of data.

        To speed it up, we can simply create an intrinsic that implements the algorithm without the Java-isms. That is a similar approach to intrinsics for SHA1/SHA256/SHA512.

        The speedup is as follows:

        -XX:-UseMD5Intrinsics
        Benchmark (digesterName) (length) (provider) Mode Cnt Score Error Units
        MessageDigests.digest md5 64 DEFAULT thrpt 10 3459.747 ± 10.508 ops/ms
        MessageDigests.digest md5 1024 DEFAULT thrpt 10 446.407 ± 3.383 ops/ms
        MessageDigests.digest md5 16384 DEFAULT thrpt 10 30.685 ± 0.676 ops/ms
        MessageDigests.digest md5 1048576 DEFAULT thrpt 10 0.483 ± 0.004 ops/ms

        -XX:+UseMD5Intrinsics
        Benchmark (digesterName) (length) (provider) Mode Cnt Score Error Units
        MessageDigests.digest md5 64 DEFAULT thrpt 10 4011.556 ± 10.212 ops/ms => 16% speedup
        MessageDigests.digest md5 1024 DEFAULT thrpt 10 526.873 ± 2.101 ops/ms => 18% speedup
        MessageDigests.digest md5 16384 DEFAULT thrpt 10 35.012 ± 0.088 ops/ms => 14% speedup
        MessageDigests.digest md5 1048576 DEFAULT thrpt 10 0.573 ± 0.002 ops/ms => 19% speedup

              luhenry Ludovic Henry
              luhenry Ludovic Henry
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: