On Wed, 6 Oct 2021 08:41:38 GMT, Sergey Bylokhov <[email protected]> wrote:
> 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.
>
> Notes:
>
> * 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):
> ||JDK 7 | JDK 8 | JDK 17 | FIX |
> |----|----|----|----|----|
> |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):
> 
>
> https://jmh.morethan.io/?gists=b1edd5e5ebeb1b76867b2112be30145d,fc86ce4a6f8f2f49e9ab512ef641c11b
This pull request has now been integrated.
Changeset: c355704a
Author: Sergey Bylokhov <[email protected]>
URL:
https://git.openjdk.java.net/jdk/commit/c355704a4b3d376b5429daba1576442b575f41ea
Stats: 137 lines in 4 files changed: 9 ins; 101 del; 27 mod
8041125: ColorConvertOp filter much slower in JDK 8 compared to JDK7
Reviewed-by: prr
-------------
PR: https://git.openjdk.java.net/jdk/pull/5835