JDK-8173581 : performance regression in com/sun/crypto/provider/OutputFeedback.java
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto
  • Affected Version: 8u112,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-01-27
  • Updated: 2017-11-29
  • Resolved: 2017-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 JDK 9
10Fixed 8u152Fixed 9 b155Fixed
Description
The fix for JDK-8049312 refactored OutputFeedback.encrypt(). See http://hg.openjdk.java.net/jdk9/dev/jdk/rev/09bcd51adf34 .

The changset was backported to jdk8u as part of 8u111/8u112 in
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/b760ad429561 .

At Google, we've noticed a performance regression on a production server using 8u112 due to this change, which can simply observed on a desktop by a 10-15% speed reduction in the jtreg test  test/com/sun/crypto/provider/Cipher/AES/CICO.java.

Looking at the refactoring in OutputFeedback.encrypt(), two calls to System.arraycopy() have moved from the outer loop to the inner, where they are invariant. The revised code is still semantically correct, but unintentionally performs poorly.  The two calls (and the guard) should be moved to the outer loop.

I hope to provide a webrev with a fix shortly.