-
Enhancement
-
Resolution: Fixed
-
P4
-
11, 16
-
b10
-
x86, x86_64
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8280978 | 15.0.7 | Paul Hohensee | P4 | Resolved | Fixed | b01 |
JDK-8251319 | 11.0.15 | Paul Hohensee | P4 | Closed | Rejected |
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
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
- backported by
-
JDK-8280978 Implement MD5 Intrinsics on x86
- Resolved
-
JDK-8251319 Implement MD5 Intrinsics on x86
- Closed
- relates to
-
JDK-8251216 Implement MD5 intrinsics on AArch64
- Resolved
-
JDK-8251260 two MD5 tests fail "RuntimeException: Unexpected count of intrinsic"
- Resolved
-
JDK-8281374 Add MD5.implCompress0 to Graal toBeInvestigated list after 8280978
- Resolved
- links to
-
Commit openjdk/jdk15u-dev/6a904b32
-
Review openjdk/jdk11u-dev/806
-
Review openjdk/jdk15u-dev/163
(3 links to)