<div dir="auto">Phil,<div dir="auto">I wondered if ang RenderingHint defaults changed since 8...</div><div dir="auto"><br></div><div dir="auto">Moreover I started playing with linux perf + jit agent and it is easy than before wigh oprofile + jvmtiagent.</div><div dir="auto"><br></div><div dir="auto">I noticed that OracleJDK8 uses KCMS and OpenJDK11 uses LCMS for color conversion as does OpenJDK8, that could explain the performance gap.</div><div dir="auto"><br></div><div dir="auto">Finally PDFImage test is run only once so the overhead may come from warmup (jit, g1)...</div><div dir="auto"><br></div><div dir="auto">More later,</div><div dir="auto">Laurent</div></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 4 oct. 2018 à 20:03, Phil Race <<a href="mailto:philip.race@oracle.com">philip.race@oracle.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="m_8353807606653352915moz-cite-prefix">On 10/03/2018 11:58 PM, Laurent Bourgès
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">Hi,
        <div dir="auto">I will get the code and add debugging logs: env
          & system properties and java2d RenderingHints.</div>
      </div>
    </blockquote>
    <br>
    The code in pdfbox passes null for the hints. So there should be no
    difference attributable to that.<br>
    <br>
    -phil.<br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto"><br>
        </div>
        <div dir="auto">I suspect these hints are different or have a
          noticiable impact: color interpolation & rendering
          quality.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I suppose the backend corresponds to software
          loops but some 2d operations can be accelerated ?</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Anyway I will push any change in the code.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">PS: I can run linux perf to profile both java
          & native code....</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Cheers,</div>
        <div dir="auto">Laurent</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">Le jeu. 4 oct. 2018 à 07:50, Daniel Persson <<a href="mailto:mailto.woden@gmail.com" target="_blank" rel="noreferrer">mailto.woden@gmail.com</a>>
          a écrit :<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr">Hi Philip and Laurent.
              <div><br>
              </div>
              <div>I've talked with Tilman and Andreas from the PDFBox
                team and they see similar connections to the
                ColorConvertOp filter but wanted to try with one of the
                images of the PDF as a raster.</div>
              <div><br>
              </div>
              <div>As we try different things I thought it good for
                collaboration to create a repository with the code so
                all can contribute.</div>
              <div><br>
              </div>
              <div><a href="https://github.com/kalaspuffar/ColorConvTest" rel="noreferrer noreferrer" target="_blank">https://github.com/kalaspuffar/ColorConvTest</a><br>
              </div>
              <div><br>
              </div>
              <div>I've run the 3 different tests on my Machine
                (Thinkpad P51s) with custom Gentoo installed, if
                important to the conversation.</div>
              <div><br>
              </div>
              <div>I tried to invite you all as collaborators to this
                repository if you think this is a bad Idea let me know.</div>
              <div><br>
              </div>
              <div>Best regards</div>
              <div>Daniel</div>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr">On Wed, Oct 3, 2018 at 7:51 PM Laurent
              Bourgès <<a href="mailto:bourges.laurent@gmail.com" rel="noreferrer noreferrer" target="_blank">bourges.laurent@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="auto">Very good job, phil.
                <div dir="auto"><br>
                </div>
                <div dir="auto">I will try your CCONV test on my linux
                  machine to see if it is platform dependent ... or hw ?</div>
                <div dir="auto"><br>
                </div>
                <div dir="auto">Laurent</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr">Le mer. 3 oct. 2018 à 19:19, Philip Race
                  <<a href="mailto:philip.race@oracle.com" rel="noreferrer noreferrer" target="_blank">philip.race@oracle.com</a>>
                  a écrit :<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div text="#000000" bgcolor="#FFFFFF"> <br>
                    <br>
                    On 10/3/18, 1:15 AM, Laurent Bourgès wrote:
                    <blockquote type="cite">
                      <div dir="auto">Phil,
                        <div dir="auto"><br>
                          <div dir="auto">If you look at the given pdf
                            file, it has large images that exceed 2k so
                            such ones may be more costly to convert.</div>
                        </div>
                      </div>
                    </blockquote>
                    <br>
                    FWIW the one I profiled was by far the largest at
                    2577x1540.<br>
                    The rest are more like 100x100, 200x200 or 500x500 -
                    all approximations.<br>
                    <blockquote type="cite">
                      <div dir="auto">
                        <div dir="auto">
                          <div dir="auto"><br>
                          </div>
                          <div dir="auto">As jpeg decoder in openjdk11
                            is different than oraclejdk8, it may cause
                            more ColorConvertOp filter operations ... if
                            color profiles are different.</div>
                        </div>
                      </div>
                    </blockquote>
                    <br>
                    That doesn't seem likely and in fact since I 
                    instrumented ColorConvertOp in 8 & 11,  I know
                    exactly how many times it was invoked<br>
                    by pdfbox, (11 times in both cases) and that all the
                    image data is the same. SRC and DEST are the same
                    types etc.<br>
                    <br>
                    Also the version of LCMS is the same in 8 and 11
                    (v2.9).<br>
                    <br>
                    -phil<br>
                    <blockquote type="cite">
                      <div dir="auto">
                        <div dir="auto">
                          <div dir="auto"><br>
                          </div>
                          <div dir="auto">Anyway this performance is not
                            related to Marlin renderer, so I can not
                            help much except in its diagnostic.</div>
                          <div dir="auto"><br>
                          </div>
                          <div dir="auto">Cheers,</div>
                          <div dir="auto">Laurent</div>
                        </div>
                      </div>
                      <br>
                      <div class="gmail_quote">
                        <div dir="ltr">Le mar. 2 oct. 2018 à 23:35,
                          Philip Race <<a href="mailto:philip.race@oracle.com" rel="noreferrer noreferrer noreferrer" target="_blank">philip.race@oracle.com</a>>
                          a écrit :<br>
                        </div>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div text="#000000" bgcolor="#FFFFFF"> I've
                            spent some time examining what pdfbox is
                            passing to ColorConvertOp<br>
                            It is called about 10 or 11 times in this
                            test with images typically 1-2K in each
                            dimension.<br>
                            The input image is a Custom BufferedImage
                            which uses an ICC_ColorSpace constructed<br>
                            from a color profile file that is embedded
                            in pdfbox which is an open source equivalent<br>
                            of what Acrobat uses. It has a 4 component
                            raster and is opaque<br>
                            <br>
                            This is filtered into a 3 component standard
                            INT_RGB ColorModel.<br>
                            <br>
                            I've distilled this down into a small
                            program which has an copy of the method<br>
                            that is defined in pdfbox and is invoking
                            the supposedly slow ColorConvertOp.<br>
                            <br>
                            So I believe this is all exactly what is
                            happening in pdfbox.<br>
                            <br>
                            What I find is that it is actually much
                            faster on JDK11 than JDK 8.<br>
                            <br>
                            prrubuntu:~$ ~/jdk-11/bin/java CConv <br>
                            4881<br>
                            prrubuntu:~$ ~/jdk8u181/bin/java CConv<br>
                            12529<br>
                            <br>
                            <br>
                            I can't say why that would be but the
                            results are clear.<br>
                            So I am left to suppose that pdfbox really
                            is doing something different in 8 vs 11.<br>
                            Or that this not the real problem. What do
                            others see ?<br>
                            <br>
                            I've attached the program. The 1Mb color
                            profile file can be got from the pdfbox
                            sources.<br>
                            <br>
                            -phil.<br>
                            <br>
                            <br>
                            On 10/2/18, 9:35 AM, Laurent Bourgès wrote:
                            <blockquote type="cite">
                              <div dir="auto">
                                <div>Hi Daniel,</div>
                                <div dir="auto">
                                  <div class="gmail_quote">
                                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                      <div dir="ltr">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div><br>
                                            </div>
                                            <div>Let's not compare
                                              apples and oranges. What I
                                              can see it takes the same
                                              route and
                                              behave similarly.</div>
                                          </div>
                                        </div>
                                      </div>
                                    </blockquote>
                                  </div>
                                </div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto"> I agree, I did not take
                                  enough time to get accurate profiles,
                                  sorry.<br>
                                </div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">
                                  <div class="gmail_quote">
                                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                      <div dir="ltr">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div><br>
                                            </div>
                                            <div>If you look at</div>
                                            <div><a href="http://uhash.com/java_reg/Call_Tree_java_8.html" rel="noreferrer
                                                noreferrer noreferrer
                                                noreferrer noreferrer" target="_blank">http://uhash.com/java_reg/Call_Tree_java_8.html</a><br>
                                            </div>
                                            <div><a href="http://uhash.com/java_reg/Call_Tree_java_11.html" rel="noreferrer
                                                noreferrer noreferrer
                                                noreferrer noreferrer" target="_blank">http://uhash.com/java_reg/Call_Tree_java_11.html</a><br>
                                            </div>
                                            <div><br>
                                            </div>
                                            <div>You can see that
                                              ConvertOp.filter takes
                                              1.5s longer on Java 11.</div>
                                          </div>
                                        </div>
                                      </div>
                                    </blockquote>
                                  </div>
                                </div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">I confirm: 1.8s vs
                                  300ms.</div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">Philip, do you know what
                                  could have change in this 2d area ?</div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">I imagine ColorConvertOp
                                  delegates to native code so color
                                  profile (ICC) or hidpi support may
                                  have an impact here (or just compiler
                                  options may be different) ...</div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">If needed, I could
                                  profile native code using oprofile /
                                  perf.</div>
                                <div dir="auto"><br>
                                </div>
                                <div dir="auto">Laurent</div>
                              </div>
                            </blockquote>
                          </div>
                        </blockquote>
                      </div>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>