[OpenJDK 2D-Dev] RFR: 8186317: Cache font layout tables for use by harfbuzz

Dmitry Batrak dmitry.batrak at jetbrains.com
Fri Aug 18 09:31:42 UTC 2017


Hello,

I was going to propose a related change a bit later, but thought it makes
sense to let you know now, as you're working on a similar thing.

In our OpenJDK-based runtime, we've optimized HarfBuzz invocations, by
creating hb_face_t object only once per Font2D instance.
This can make layout 2-3 times faster (more prominent for fonts with a lot
of layout rules, e.g. Fira Code).
We have this working in production for about a year now, without issues.

I've created a corresponding webrev here
  http://cr.openjdk.java.net/~dbatrak/hb-optimization/webrev.00/
It's generated 'as is', it should probably be reworked, if it's going to be
included in OpenJDK. In particular, caching of hb_face_t objects
should probably be encapsulated in SunLayoutEngine, and not done in Font2D
object directly.

I'm ready to work on the change further, following the formal procedure
(raising the ticket, submitting RFRs, etc). So, please let me know
if you're interested, and whether you have any comments or suggestions. In
any case, I'll require someone sponsoring this change,
as I don't have a Committer status.

Best regards,
Dmitry Batrak


On Thu, Aug 17, 2017 at 12:07 AM, Phil Race <philip.race at oracle.com> wrote:

> Bug: https://bugs.openjdk.java.net/browse/JDK-8186317
> Webrev: http://cr.openjdk.java.net/~prr/8186317/
>
> In the ICU code path, we cache the layout tables in native memory so that
> when requested by ICU we can just hand the pointer, saving the overhead
> of copying the Java array for every call to layout.
>
> We weren't doing this for harfbuzz and this webrev fixes that.
>
> I noticed harfbuzz always retrieves the 'head' table so I decided to add
> that to the list of
> cached tables.
>
> The overall result is something like 25-30% performance gain.
>
> -phil.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20170818/02a38386/attachment.html>


More information about the 2d-dev mailing list