RFR[M]: Adding MD5 Intrinsic on x86-64

Ludovic Henry luhenry at microsoft.com
Fri Jul 31 01:26:00 UTC 2020


JBS: I just got authorship status and I'll create a bug as soon as I have access to JBS
Webrev: http://cr.openjdk.java.net/~luhenry/md5-intrinsics/webrev.00/

The problem ended up not being with how `ofs` was incremented, but with a callee-saved register not being restored properly before returning from the intrinsic.

The performance results from running with JMH are very encouraging. I ran the `org.openjdk.bench.java.security.MessageDigests` with MD5 only enabled, and following are the results with and without the intrinsic.

-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
MessageDigests.digest             md5      1024     DEFAULT  thrpt   10   526.873 ±  2.101  ops/ms
MessageDigests.digest             md5     16384     DEFAULT  thrpt   10    35.012 ±  0.088  ops/ms
MessageDigests.digest             md5   1048576     DEFAULT  thrpt   10     0.573 ±  0.002  ops/ms

That's overall a jump from ~483MB/s to ~573MB/s on the 1M chunks, or a ~19% speedup.

Thank you,
Ludovic


More information about the hotspot-compiler-dev mailing list