2

The Kodak color management system (KCMS) has been replaced in openJDK with LittleCMS (LCMS) starting from Java 10. In Java8 and 9 it was still available but not the default anymore. It could be activated with:

// force KCMS
System.setProperty("sun.java2d.cmm","sun.java2d.cmm.kcms.KcmsServiceProvider");

There were understandable reasons for that: LCMS is an Open Source project, it supports modern ICC profiles, it is maintained (vs. KCMS open bug) and so on. There is a tradeoff however: the ColorConversionOp (CConv) is much slower than the original KCMS. The reason is that KCMS is (4x) multi-threaded but LCMS is not. There is a lengthy thread with all the details...

While everyday users are probably not impacted by this too much, there is one application area which is greatly impacted. I searched for problems with the KCMS->LCMS switch and found the following:

Quote from jpedal:

Over the last month, we noticed a major slowdown in our regression tests. A test cycle which used to take 30 minutes was taking 82 minutes.

For everybody who wants to try out, there is an example project to test for yourself.

It becomes clear that especially one area is really suffering from this: Java PDF processing.

But why am I writing this?

Would it be possible to create a standalone KCMS library? Which could be loaded for projects which need it? Comparable with the JPG2K lib which was excluded from JAI but made available as a separate lib.

I searched online (and found some documentation however) didn't find the source code for it. Is the code or a lib somewhere available? Would that even be possible?

Lonzak
  • 9,334
  • 5
  • 57
  • 88
  • I felt that this is no longer a problem after jdk8-192. But yeah, Oracle should invest much more development power to fix their bugs and optimize their product instead of implementing obscure features. – Tilman Hausherr Jan 29 '21 at 07:16
  • What happened in 8u192? KCMS is still part of this version and also used by pdfbox due to the mentioned "hardwiring". Did you make a test with JDK11 where KCMS is no longer available? My experience is that its remarkably slower (of course depending on the document). – Lonzak Jan 29 '21 at 08:04
  • I noticed that LCMS was no longer slow. We removed the log message recommending KCMS, except when java8 < 192 is used. JDK11 is also better. (This is a general impression, I didn't retry the specific test you link to) – Tilman Hausherr Jan 29 '21 at 08:35
  • KCMS was (AFAIK) licensed by Sun/Oracle from Kodak. It's proprietary and not open source, so even if you found the source code online, I don't think it could be used. I think our best bet is to invest time and money in supporting OpenJDK and LCMS to make things faster. – Harald K Jan 29 '21 at 09:13
  • I ran my rendering tests (about 1000 files), and it took 8 min with the latest amazon corretto jdk8 and 6 min with the latest amazon corretto jdk11. – Tilman Hausherr Jan 29 '21 at 16:29
  • And when running with the latest jdk8 you did probably use LCMS (since it is > 192). Can you try to enforce KCMS and run it again? – Lonzak Jan 29 '21 at 16:33
  • I get an error message "KCMS not available". Seems they removed it?! – Tilman Hausherr Jan 29 '21 at 16:43
  • 3
    Mhm interesting. I searched a bit and it seems indeed that it was removed: http://mail.openjdk.java.net/pipermail/build-dev/2018-July/022782.html – Lonzak Feb 01 '21 at 08:01

0 Answers0