[OpenJDK 2D-Dev] Rendering images from PDF files slower in OpenJDK
Daniel Persson
mailto.woden at gmail.com
Tue Oct 2 13:03:14 UTC 2018
Hi Phil and Laurent
Let's not compare apples and oranges. What I can see it takes the same
route and behave similarly.
If you look at
http://uhash.com/java_reg/Call_Tree_java_8.html
http://uhash.com/java_reg/Call_Tree_java_11.html
You can see that ConvertOp.filter takes 1.5s longer on Java 11.
If you want to see the full Call trees to check other eventual culprits you
can find them here.
http://uhash.com/java_reg/Call_Tree_java_8_full.html
http://uhash.com/java_reg/Call_Tree_java_11_full.html
Best regards
Daniel
On Mon, Oct 1, 2018 at 11:10 PM Phil Race <philip.race at oracle.com> wrote:
> Thanks for the profiles.
>
> I can't tell - from the profile - or even from [just looking at] the
> pdfbox
> source what might be causing it to behave differently or why
> it adds up to so much slower.
>
> "Full stack" debugging - meaning building pdfbox seems to be necessary.
> So I think that it might be best that if the pdfbox devs. do the initial
> evaluation.
> Else it will wait a long time ...
>
> -phil.
>
> On 10/01/2018 10:52 AM, Laurent Bourgès wrote:
>
> Hi,
> I quickly run your test with Oracle JDK8 and OpenJDK 11:
> Here are the CPU profiles:
> http://cr.openjdk.java.net/~lbourges/pdfbox_profiles/
>
> On JDK8:
> java version "1.8.0_192-ea"
> Java(TM) SE Runtime Environment (build 1.8.0_192-ea-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 25.192-b04, mixed mode)
> Rendered 1 page in 3375ms
>
> 777 ms org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.
> getRGBImage
> 17.8% - 766 ms
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit
> 12.6% - 541 ms
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream
> 12.6% - 541 ms org.apache.pdfbox.pdmodel.comm
> on.PDStream.createInputStream
>
> On JDK11:
>
> openjdk version "11" 2018-09-25
> OpenJDK Runtime Environment 18.9 (build 11+28)
> OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
> Rendered 1 page in 4789ms
>
> 2,059 ms org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.
> getRGBImage
> 36.0% - 2,054 ms
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit
> 26.2% - 1,495 ms
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK.toRGBImage
> 26.2% - 1,495 ms
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceCMYK.toRGBImageAWT
> 26.2% - 1,495 ms
> org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImageAWT
> 26.0% - 1,481 ms java.awt.image.ColorConvertOp.filter
>
> Actually, pdfbox's SampledImageReader.from8bit() do not use the same
> path between JDK8 and JDK11... and ColorConvertOp costs 25% (in my
> case)
>
> Cheers,
> Laurent
>
> Le jeu. 27 sept. 2018 à 09:19, Laurent Bourgès <bourges.laurent at gmail.com>
> a écrit :
>
>> Hi,
>>
>> FYI I will run profilers on this test case to compare Oracle JDK8 vs
>> OpenJDK11...
>> Will then give you my analysis.
>>
>> Cheers,
>> Laurent
>>
>> Le mer. 26 sept. 2018 à 23:51, Philip Race <philip.race at oracle.com> a
>> écrit :
>>
>>> Interesting and I assume that it was somewhat less in JD8u ?
>>> Off the top of my head that is one thing that didn't change in any big
>>> way since JDK 8u.
>>>
>>> Perhaps something has changed so that it is now [considered] needed
>>> whereas before
>>> it was not? So did it go from zero percent to 29% or from 10% to 29% ?
>>>
>>> But even that doesn't on it own account for everything.
>>> 29% of 8 seconds would be about 2.5 seconds and doesn't explain going
>>> from
>>> < 3 seconds to 8 seconds .. we are still missing at least 2.5 seconds ..
>>>
>>>
>>> -phil.
>>>
>>> On 9/26/18, 11:08 AM, Daniel Persson wrote:
>>>
>>> Hi Phil
>>>
>>> What the PDFBox team told me it could have something to do with color
>>> mapping.
>>>
>>> And my quick profiling shows that the code spends 29% of the time inside
>>> of java.awt.image.ColorConvertOp.filter on java 11
>>>
>>> But I'll open a issue.
>>>
>>> Best regards
>>> Daniel
>>>
>>> On Wed, Sep 26, 2018, 19:33 Phil Race <philip.race at oracle.com> wrote:
>>>
>>>> Multiple pieces are changing across these releases.
>>>>
>>>> Is it the JPEG writing ? Is it freetype vs t2k (font performance)
>>>> is it harfbuzz vs icu (text layout), is it marlin vs ductus
>>>> (rasterization) ?
>>>>
>>>> So it is very hard to say with any certainty what the cause of the
>>>> difference is .. or
>>>> why 10 got so much better than 9 .. even if still not back to JDK 8.
>>>>
>>>> Please file a bug at java.com.
>>>>
>>>> -phil.
>>>>
>>>> On 09/25/2018 10:42 PM, Daniel Persson wrote:
>>>> > Hi everyone,
>>>> >
>>>> > We render a lot of images with PDFBox with Java 1.8.0 and we want to
>>>> > upgrade to the current OpenJDK 11 but sadly we see some performance
>>>> > degradation switching over to OpenJDK. Anyone have a suggestion to
>>>> > remedy this issue, or can explain why it is slower?
>>>> >
>>>> > Using the PDFBox app current release downloadable from
>>>> > http://www-us.apache.org/dist/pdfbox/2.0.11/pdfbox-app-2.0.11.jar
>>>> >
>>>> > Running the command
>>>> > java -jar pdfbox-app-2.0.11.jar PDFToImage -time test.pdf
>>>> >
>>>> > We see the following result
>>>> >
>>>> > ---------------------------------------------------------
>>>> > java version "1.8.0_181"
>>>> > Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
>>>> > Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
>>>> > Rendered 1 page in 2762ms
>>>> > ---------------------------------------------------------
>>>> > openjdk version "9.0.4"
>>>> > OpenJDK Runtime Environment (build 9.0.4+11)
>>>> > OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
>>>> > Rendered 1 page in 8034ms
>>>> > ---------------------------------------------------------
>>>> > openjdk version "10.0.2" 2018-07-17
>>>> > OpenJDK Runtime Environment 18.3 (build 10.0.2+13)
>>>> > OpenJDK 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
>>>> > Rendered 1 page in 4255ms
>>>> > ---------------------------------------------------------
>>>> > openjdk version "11" 2018-09-25
>>>> > OpenJDK Runtime Environment 18.9 (build 11+28)
>>>> > OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
>>>> > Rendered 1 page in 4275ms
>>>> > ---------------------------------------------------------
>>>> > openjdk version "12-ea" 2019-03-19
>>>> > OpenJDK Runtime Environment 19.3 (build 12-ea+11)
>>>> > OpenJDK 64-Bit Server VM 19.3 (build 12-ea+11, mixed mode)
>>>> > Rendered 1 page in 4399ms
>>>> >
>>>> > The pdf file used in this example can be downloaded from
>>>> >
>>>> https://drive.google.com/file/d/139wP6PDmmQ6KBTyeJTETIrplSuOUgFfG/view?usp=sharing
>>>> >
>>>> > Best regards
>>>> > Daniel
>>>>
>>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20181002/e24547c0/attachment.html>
More information about the 2d-dev
mailing list