[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] [PATCH] 8220231: Cache HarfBuzz face object for same font's text layout calls
From:       Phil Race <philip.race () oracle ! com>
Date:       2019-04-11 16:45:34
Message-ID: f3e92d7d-7df1-bdbe-5061-4eb755f3da2e () oracle ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

OK .. since no one else seems to be doing this I'll handle it for you.

-phil.

On 4/9/19 12:28 AM, Dmitry Batrak wrote:
> Thanks!
>
> Hopefully someone can push (sponsor) it now.
>
> Best regards,
> Dmitry Batrak
>
>
> On Mon, Apr 8, 2019 at 10:16 PM Sergey Bylokhov 
> <Sergey.Bylokhov@oracle.com <mailto:Sergey.Bylokhov@oracle.com>> wrote:
>
>     +1
>
>     On 01/04/2019 02:12, Alexey Ushakov wrote:
>     > Looks good for me.
>     >
>     > Best Regards,
>     > Alexey
>     >
>     > On Mon, Apr 1, 2019 at 10:46 AM Dmitry Batrak
>     <dmitry.batrak@jetbrains.com <mailto:dmitry.batrak@jetbrains.com>
>     <mailto:dmitry.batrak@jetbrains.com
>     <mailto:dmitry.batrak@jetbrains.com>>> wrote:
>     >
>     >      > Sorry for the delay. I've now finished verifying this and
>     it is a +1 from me.
>     >     Thanks!
>     >
>     >     Anyone else, please? A second reviewer is required.
>     >
>     >     On Mon, Mar 25, 2019 at 11:19 PM Philip Race
>     <philip.race@oracle.com <mailto:philip.race@oracle.com>
>     <mailto:philip.race@oracle.com <mailto:philip.race@oracle.com>>>
>     wrote:
>     >
>     >         Sorry for the delay. I've now finished verifying this
>     and it is a +1 from me.
>     >
>     >         -phil.
>     >
>     >         On 3/12/19, 1:32 AM, Dmitry Batrak wrote:
>     >>         > This looks good to me, if I understand correctly that
>     we now create
>     >>         > the face on first use and cache it fin Java or as
>     long as the Font2D is
>     >>         > alive.
>     >>         > And the JNIEnv is always found on
>     >>         That's correct. The assumption is that HarfBuzz doesn't
>     create its own threads,
>     >>         so HarfBuzz-related native code will always be invoked
>     from a Java thread
>     >>         (as part of 'shape' call), and so JNIEnv will be
>     available in that context.
>     >>
>     >>         I've updated the webrev by including a stress test for
>     multi-threaded behaviour
>     >>         testing. Apart from the test, webrev also has some
>     cosmetic differences
>     >>         from the previous version (like a comment fix or
>     parameter order changing),
>     >>         appeared during 'splitting' process. To simplify the
>     review, I'm also providing
>     >>         the links to the 'split' version of the same webrev -
>     three parts that produce
>     >>         the same result when combined. I've not tested the
>     changes separately
>     >>         (except basic compilation check).
>     >>
>     >>         Complete change:
>     >> http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01/
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01/>
>     >>         Part 1 (caching hb_face_t):
>     >> http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-1/
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-1/>
>     >>         Part 2 (tables caching removal):
>     >> http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-2/
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-2/>
>     >>         Part 3 (scaler pointer passing removal):
>     >> http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-3/
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-3/>
>     >>
>     >>         Best regards,
>     >>         Dmitry Batrak
>     >>
>     >>         On Fri, Mar 8, 2019 at 3:21 AM Philip Race
>     <philip.race@oracle.com <mailto:philip.race@oracle.com>
>     <mailto:philip.race@oracle.com <mailto:philip.race@oracle.com>>>
>     wrote:
>     >>
>     >>             This looks good to me, if I understand correctly
>     that we now create
>     >>             the face on first use and cache it fin Java or as
>     long as the Font2D is
>     >>             alive.
>     >>             And the JNIEnv is always found on
>     >>
>     >>             I think you are right that we don't need the
>     caching of the tables since
>     >>             now the face will do it. The unfortunate thing is
>     that the removal of
>     >>             this code is
>     >>             well over half the changes and as such it greatly
>     muddied finding the
>     >>             changes
>     >>             that make the performance difference so my review
>     was harder and less
>     >>             certain
>     >>             because of that.
>     >>             It could have been separated into a follow-on
>     change I think so that it
>     >>             would have
>     >>             been easier to review the important change.
>     >>
>     >>             The pScaler parameter looks like it is unused these
>     days which is why I
>     >>             expect you removed it but also not directly relevant.
>     >>
>     >>             I have run builds + some tests - but I'm not in a
>     position to run more tests
>     >>             for a couple of weeks.
>     >>
>     >>             A (mild) stress test re-using the same font from
>     multiple threads eachmaking
>     >>             multiple calls into layout would be a good addition
>     here. That should
>     >>             help tell
>     >>             us if there are any MT or re-entrancy problems. Can
>     you provide such a
>     >>             test ?
>     >>             It will be a good thing to have automatically run
>     to catch any problems
>     >>             introduced later either on the Java side or by an
>     update to harfbuzz.
>     >>
>     >>             -phil.
>     >>
>     >>
>     >>
>     >>             On 3/6/19, 5:45 PM, Dmitry Batrak wrote:
>     >>             > Hello,
>     >>             >
>     >>             > I'd like to submit a patch for JDK-8220231. I'm
>     not a Committer, so
>     >>             > I'll need someone to sponsor this change.
>     >>             >
>     >>             > The proposed approach is used without known
>     issues in OpenJDK-based
>     >>             > JetBrains Runtime for almost three years now.
>     I've mentioned it
>     >>             > previously on this mailing list
>     >>             >
>     (https://mail.openjdk.java.net/pipermail/2d-dev/2017-August/008497.html).
>     >>             > The change has been refactored as compared to the
>     version mentioned
>     >>             > above (the logic has been moved to
>     SunLayoutEngine), and includes the
>     >>             > removal of font tables caching (JDK-8186317). The
>     latter, I believe,
>     >>             > becomes redundant with this fix.
>     >>             >
>     >>             > Issue:
>     https://bugs.openjdk.java.net/browse/JDK-8220231
>     >>             > Webrev:
>     http://cr.openjdk.java.net/~dbatrak/8220231/webrev.00/
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/>
>     >>             >
>     <http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/>
>     >>             >
>     >>             > Best regards,
>     >>             > Dmitry Batrak
>     >>             >
>     >>
>     >>
>     >>
>     >
>     >
>     >     --
>     >     Dmitry Batrak
>     >     Senior Software Developer
>     >     JetBrains
>     > http://www.jetbrains.com
>     >     The Drive to Develop
>     >
>
>
>     -- 
>     Best regards, Sergey.
>
>


[Attachment #3 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    OK .. since no one else seems to be doing this I'll handle it for
    you.<br>
    <br>
    -phil.<br>
    <br>
    <div class="moz-cite-prefix">On 4/9/19 12:28 AM, Dmitry Batrak
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAET5FPvQETTpsgcrUF+Ogc7_9=EQzZjMBBiiRfOK0OebjJWcNQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div>Thanks!</div>
          <div><br>
          </div>
          <div>Hopefully someone can push (sponsor) it now.</div>
          <div><br>
          </div>
          <div>Best regards,</div>
          <div>Dmitry Batrak<br>
          </div>
          <div><br>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Mon, Apr 8, 2019 at 10:16
            PM Sergey Bylokhov &lt;<a
              href="mailto:Sergey.Bylokhov@oracle.com"
              moz-do-not-send="true">Sergey.Bylokhov@oracle.com</a>&gt;
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">+1<br>
            <br>
            On 01/04/2019 02:12, Alexey Ushakov wrote:<br>
            &gt; Looks good for me.<br>
            &gt; <br>
            &gt; Best Regards,<br>
            &gt; Alexey<br>
            &gt; <br>
            &gt; On Mon, Apr 1, 2019 at 10:46 AM Dmitry Batrak &lt;<a
              href="mailto:dmitry.batrak@jetbrains.com" target="_blank"
              moz-do-not-send="true">dmitry.batrak@jetbrains.com</a>
            &lt;mailto:<a href="mailto:dmitry.batrak@jetbrains.com"
              target="_blank" \
moz-do-not-send="true">dmitry.batrak@jetbrains.com</a>&gt;&gt;  wrote:<br>
            &gt; <br>
            &gt;         &gt; Sorry for the delay. I've now finished
            verifying this and it is a +1 from me.<br>
            &gt;        Thanks!<br>
            &gt; <br>
            &gt;        Anyone else, please? A second reviewer is required.<br>
            &gt; <br>
            &gt;        On Mon, Mar 25, 2019 at 11:19 PM Philip Race &lt;<a
              href="mailto:philip.race@oracle.com" target="_blank"
              moz-do-not-send="true">philip.race@oracle.com</a>
            &lt;mailto:<a href="mailto:philip.race@oracle.com"
              target="_blank" \
moz-do-not-send="true">philip.race@oracle.com</a>&gt;&gt;  wrote:<br>
            &gt; <br>
            &gt;              Sorry for the delay. I've now finished
            verifying this and it is a +1 from me.<br>
            &gt; <br>
            &gt;              -phil.<br>
            &gt; <br>
            &gt;              On 3/12/19, 1:32 AM, Dmitry Batrak wrote:<br>
            &gt;&gt;              &gt; This looks good to me, if I understand
            correctly that we now create<br>
            &gt;&gt;              &gt; the face on first use and cache it fin
            Java or as long as the Font2D is<br>
            &gt;&gt;              &gt; alive.<br>
            &gt;&gt;              &gt; And the JNIEnv is always found on<br>
            &gt;&gt;              That's correct. The assumption is that
            HarfBuzz doesn't create its own threads,<br>
            &gt;&gt;              so HarfBuzz-related native code will always
            be invoked from a Java thread<br>
            &gt;&gt;              (as part of 'shape' call), and so JNIEnv
            will be available in that context.<br>
            &gt;&gt;<br>
            &gt;&gt;              I've updated the webrev by including a
            stress test for multi-threaded behaviour<br>
            &gt;&gt;              testing. Apart from the test, webrev also
            has some cosmetic differences<br>
            &gt;&gt;              from the previous version (like a comment
            fix or parameter order changing),<br>
            &gt;&gt;              appeared during 'splitting' process. To
            simplify the review, I'm also providing<br>
            &gt;&gt;              the links to the 'split' version of the
            same webrev - three parts that produce<br>
            &gt;&gt;              the same result when combined. I've not
            tested the changes separately<br>
            &gt;&gt;              (except basic compilation check).<br>
            &gt;&gt;<br>
            &gt;&gt;              Complete change:<br>
            &gt;&gt;              <a
              href="http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01/</a>  \
                &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01/</a>&gt;<br>
  &gt;&gt;              Part 1 (caching hb_face_t):<br>
            &gt;&gt;              <a
              href="http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-1/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-1/</a>  \
                &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-1/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-1/</a>&gt;<br>
  &gt;&gt;              Part 2 (tables caching removal):<br>
            &gt;&gt;              <a
              href="http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-2/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-2/</a>  \
                &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-2/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-2/</a>&gt;<br>
                
            &gt;&gt;              Part 3 (scaler pointer passing removal):<br>
            &gt;&gt;              <a
              href="http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-3/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dbatrak/8220231/webrev.01-3/</a>  \
                &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-3/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.01-3/</a>&gt;<br>
  &gt;&gt;<br>
            &gt;&gt;              Best regards,<br>
            &gt;&gt;              Dmitry Batrak<br>
            &gt;&gt;<br>
            &gt;&gt;              On Fri, Mar 8, 2019 at 3:21 AM Philip Race
            &lt;<a href="mailto:philip.race@oracle.com" target="_blank"
              moz-do-not-send="true">philip.race@oracle.com</a>
            &lt;mailto:<a href="mailto:philip.race@oracle.com"
              target="_blank" \
moz-do-not-send="true">philip.race@oracle.com</a>&gt;&gt;  wrote:<br>
            &gt;&gt;<br>
            &gt;&gt;                    This looks good to me, if I understand
            correctly that we now create<br>
            &gt;&gt;                    the face on first use and cache it fin
            Java or as long as the Font2D is<br>
            &gt;&gt;                    alive.<br>
            &gt;&gt;                    And the JNIEnv is always found on<br>
            &gt;&gt;<br>
            &gt;&gt;                    I think you are right that we don't
            need the caching of the tables since<br>
            &gt;&gt;                    now the face will do it. The
            unfortunate thing is that the removal of<br>
            &gt;&gt;                    this code is<br>
            &gt;&gt;                    well over half the changes and as such
            it greatly muddied finding the<br>
            &gt;&gt;                    changes<br>
            &gt;&gt;                    that make the performance difference so
            my review was harder and less<br>
            &gt;&gt;                    certain<br>
            &gt;&gt;                    because of that.<br>
            &gt;&gt;                    It could have been separated into a
            follow-on change I think so that it<br>
            &gt;&gt;                    would have<br>
            &gt;&gt;                    been easier to review the important
            change.<br>
            &gt;&gt;<br>
            &gt;&gt;                    The pScaler parameter looks like it is
            unused these days which is why I<br>
            &gt;&gt;                    expect you removed it but also not
            directly relevant.<br>
            &gt;&gt;<br>
            &gt;&gt;                    I have run builds + some tests - but
            I'm not in a position to run more tests<br>
            &gt;&gt;                    for a couple of weeks.<br>
            &gt;&gt;<br>
            &gt;&gt;                    A (mild) stress test re-using the same
            font from multiple threads eachmaking<br>
            &gt;&gt;                    multiple calls into layout would be a
            good addition here. That should<br>
            &gt;&gt;                    help tell<br>
            &gt;&gt;                    us if there are any MT or re-entrancy
            problems. Can you provide such a<br>
            &gt;&gt;                    test ?<br>
            &gt;&gt;                    It will be a good thing to have
            automatically run to catch any problems<br>
            &gt;&gt;                    introduced later either on the Java
            side or by an update to harfbuzz.<br>
            &gt;&gt;<br>
            &gt;&gt;                    -phil.<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt;                    On 3/6/19, 5:45 PM, Dmitry Batrak
            wrote:<br>
            &gt;&gt;                    &gt; Hello,<br>
            &gt;&gt;                    &gt;<br>
            &gt;&gt;                    &gt; I'd like to submit a patch for
            JDK-8220231. I'm not a Committer, so<br>
            &gt;&gt;                    &gt; I'll need someone to sponsor this
            change.<br>
            &gt;&gt;                    &gt;<br>
            &gt;&gt;                    &gt; The proposed approach is used
            without known issues in OpenJDK-based<br>
            &gt;&gt;                    &gt; JetBrains Runtime for almost three
            years now. I've mentioned it<br>
            &gt;&gt;                    &gt; previously on this mailing list<br>
            &gt;&gt;                    &gt; (<a
href="https://mail.openjdk.java.net/pipermail/2d-dev/2017-August/008497.html"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://mail.openjdk.java.net/pipermail/2d-dev/2017-August/008497.html</a>).<br>
                
            &gt;&gt;                    &gt; The change has been refactored as
            compared to the version mentioned<br>
            &gt;&gt;                    &gt; above (the logic has been moved to
            SunLayoutEngine), and includes the<br>
            &gt;&gt;                    &gt; removal of font tables caching
            (JDK-8186317). The latter, I believe,<br>
            &gt;&gt;                    &gt; becomes redundant with this fix.<br>
            &gt;&gt;                    &gt;<br>
            &gt;&gt;                    &gt; Issue: <a
              href="https://bugs.openjdk.java.net/browse/JDK-8220231"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8220231</a><br>  \
                &gt;&gt;                    &gt; Webrev: <a
              href="http://cr.openjdk.java.net/~dbatrak/8220231/webrev.00/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dbatrak/8220231/webrev.00/</a>  \
                &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/</a>&gt;<br>
  &gt;&gt;                    &gt; &lt;<a
              href="http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/"
              rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://cr.openjdk.java.net/%7Edbatrak/8220231/webrev.00/</a>&gt;<br>
  &gt;&gt;                    &gt;<br>
            &gt;&gt;                    &gt; Best regards,<br>
            &gt;&gt;                    &gt; Dmitry Batrak<br>
            &gt;&gt;                    &gt;<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt; <br>
            &gt; <br>
            &gt;        -- <br>
            &gt;        Dmitry Batrak<br>
            &gt;        Senior Software Developer<br>
            &gt;        JetBrains<br>
            &gt;        <a href="http://www.jetbrains.com" rel="noreferrer"
              target="_blank" moz-do-not-send="true">http://www.jetbrains.com</a><br>
            &gt;        The Drive to Develop<br>
            &gt; <br>
            <br>
            <br>
            -- <br>
            Best regards, Sergey.<br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic