freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: speeding up auto-hinter start-up


From: Behdad Esfahbod
Subject: Re: speeding up auto-hinter start-up
Date: Sun, 15 Jun 2025 11:40:54 -0600

Hi Werner,

I have an idea. Similar in essence to `af_map_lookup`, just using another style to avoid extra allocations.

Basically, to get gid's variants, you will check `gid + (i << 24)` for i being 0, 1, 2, ... until you hit a miss.

This allows for just one hash table to be returned. Allows for 24bit gid's. Its only limitation is 8bit of alternates, but if you see gid has alternate at index 255, you can use to the slower API to get all the remaining alternates.

Does that sound good to you? I can go ahead and prototype it.


On Sun, Jun 15, 2025 at 1:00 AM Werner LEMBERG <wl@gnu.org> wrote:

I've just submitted a Merge Request to speed up the auto-hinter
start-up.  The previous code using HarfBuzz functions was far too slow
to be acceptable – HarfBuzz (currently) doesn't exactly provide what
we need, causing way to much overhead.

To speed things up it was necessary to (partially) parse, validate and
access the GSUB table.  I really tried to avoid that, but...

Please have a look!  The speed-up is really impressive, I think; the
old code slowed down the start-up time by more than 300% (in
comparison to a commit before introducing vertical accent
positioning), while the new code only adds about 25%.

  https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381

Ideally, I would like to get rid of the GSUB code since it doesn't fit
conceptually into FreeType (and HarfBuzz does it anyway).  Behdad, do
you have ideas whether something similar to `af_map_lookup` could be
added to HarfBuzz?  This would be a long-term solution, since even if
HarfBuzz gets fitting functionality I don't want to make FreeType
depend on the newest HarfBuzz version...


    Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]