Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8041125: ColorConvertOp filter much slower in JDK 8 compared to JDK7 #5835

wants to merge 2 commits into from


Copy link

@mrserb mrserb commented Oct 6, 2021

We have improved the cmm code over a few releases and mostly resolve the JDK-8041125. But I have executed an attached test case under a profiler and found that:

  • less than 10% is an actual pixel transformation inside littlecms
  • 30% is a native up-calls like getXXField
  • 30% is incoming arrays coping
  • 30% results array saving
  • others

This change removes the native up-calls and passes all data from the java side.


  • The above numbers are true for the "pure Java" implementation in the test case, where we transform the image pixel by pixel, if the image is big and we transform it at once via filter then we spend most of the time in the littlecms code
  • JDK7 uses 4 threads in the filter implementation, but single-threaded jdk17 is faster because of some code improvement in cmm profiles initialization during the "cold start". And probably because the image is not so big(625x843).
  • If the size of the image will be increased and the warmup is done the jdk7 will be 4x time faster, this is another opportunity that I'll try to resolve later.

Tested on macOS (fastest result after a few runs):

With filter 307 ms 456 ms 242 ms 236 ms
In pure Java 1672 ms 389 ms 300 ms 259 ms

JMH before/after the fix
ColorSpace.toRGB/fromRGB/toCIEXYZ/fromCIEXYZ(new float[]{1,1,1})
single threaded and multi-threaded(MAX = 30):


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


  • JDK-8041125: ColorConvertOp filter much slower in JDK 8 compared to JDK7



Using git

Checkout this PR locally:
$ git fetch pull/5835/head:pull/5835
$ git checkout pull/5835

Update a local copy of the PR:
$ git checkout pull/5835
$ git pull pull/5835/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5835

View PR using the GUI difftool:
$ git pr show -t 5835

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented Oct 6, 2021

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Copy link

@openjdk openjdk bot commented Oct 6, 2021

@mrserb The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client label Oct 6, 2021
@mrserb mrserb marked this pull request as ready for review Oct 6, 2021
@openjdk openjdk bot added the rfr label Oct 6, 2021
Copy link

@mlbridge mlbridge bot commented Oct 6, 2021


prrace approved these changes Oct 13, 2021
Copy link

@openjdk openjdk bot commented Oct 13, 2021

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8041125: ColorConvertOp filter much slower in JDK 8 compared to JDK7

Reviewed-by: prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 133 new commits pushed to the master branch:

  • d15fbc2: 8275187: Suppress warnings on non-serializable array component types in java.sql.rowset
  • d8f6b6c: 8274718: runtime/cds/appcds/ fails with -XX:-CompactStrings
  • 451a296: 8275173: testlibrary_tests/ir_framework/tests/ fails after JDK-8274911
  • 5ffb5d1: 8272992: Replace usages of Collections.sort with List.sort call in jdk.* modules
  • b8cb76a: 8273682: Upgrade Jline to 3.20.0
  • dcf428c: 8275075: Remove unnecessary conversion to String in jdk.hotspot.agent
  • c3b75c6: 8274516: [REDO] JDK-8271880: Tighten condition for excluding regions from collecting cards with cross-references
  • 337b73a: 8274851: [PPC64] Port zgc to linux on ppc64le
  • cf82867: 8275049: [ZGC] missing null check in ZNMethod::log_register
  • ab34cce: 8275186: Suppress warnings on non-serializable array component types in xml
  • ... and 123 more:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Oct 13, 2021
Copy link
Member Author

@mrserb mrserb commented Oct 15, 2021


Copy link

@openjdk openjdk bot commented Oct 15, 2021

Going to push as commit c355704.
Since your change was applied there have been 146 commits pushed to the master branch:

  • 9623d5b: 8275265: java/nio/channels tests needing large heap sizes fail on x86_32
  • 21df412: 8275240: Change nested classes in jdk.attach to static nested classes
  • a16f2d0: 8272908: Missing coverage for certain classes in
  • ede3f4e: 8274795: AArch64: avoid spilling and restoring r18 in macro assembler
  • 40d69f0: 8254267: javax/xml/crypto/dsig/ failed with "RuntimeException: Unexpected log output:"
  • 54b8870: 8275035: Clean up worker thread infrastructure
  • 3b0b6ad: 8275226: Shenandoah: Relax memory constraint for worker claiming tasks/ranges
  • 8d9004b: 8274781: Use monospace font for enclosing interface
  • 333c469: 8275262: [BACKOUT] AArch64: Implement string_compare intrinsic in SVE
  • 8b1b6f9: 8269559: AArch64: Implement string_compare intrinsic in SVE
  • ... and 136 more:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 15, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 15, 2021
Copy link

@openjdk openjdk bot commented Oct 15, 2021

@mrserb Pushed as commit c355704.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb mrserb deleted the jni_cleanup branch Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants