[HarfBuzz] Amiri and OpenType performance

Khaled Hosny khaledhosny at eglug.org
Mon Apr 15 13:25:08 PDT 2013


On Mon, Apr 15, 2013 at 03:59:31PM -0400, Behdad Esfahbod wrote:
> On 13-04-15 03:52 PM, Khaled Hosny wrote:
> > On Mon, Apr 15, 2013 at 03:48:26PM -0400, Behdad Esfahbod wrote:
> >> On a private thread (which I wish was on the public list) with Konstantin we
> >> were measuring performance of harfbuzz-ng vs old and I noticed that shaping
> >> with Amiri roughly involves hundreds of lookups.  Unfortunately OpenType
> >> shaping runtime is at best linear in the number of lookups.  Any chance you
> >> can look into possibly consolidating some of those?
> > 
> > I didn’t consider this before, but probably I can do something. How do
> > you measure the performance?
> 
> Added --num-iterations for that.
> 
> I'm testing with:
> 
> $ echo "هو أمّا حكومة القاذفات مكن, وفي تنفّس الشرقي لهيمنة أن. هو قام هزيمة
> وأزيز اندلاع, ومن أي وبداية الواقعة. و إخضاع" | time hb-shape
> ~/fonts/amiri-0.105/amiri-regular.ttf --output-file /dev/null --shaper old
> --num-iterations=10000
> 8.88user 0.00system 0:08.91elapsed 99%CPU (0avgtext+0avgdata 17120maxresident)k
> 0inputs+0outputs (0major+1190minor)pagefaults 0swaps
> 
> Note that if I choose the fallback shaper, essentially 98.5% of the time goes
> away! :(
> 
> $ echo "هو أمّا حكومة القاذفات مكن, وفي تنفّس الشرقي لهيمنة أن. هو قام هزيمة
> وأزيز اندلاع, ومن أي وبداية الواقعة. و إخضاع" | time hb-shape
> ~/fonts/amiri-0.105/amiri-regular.ttf --output-file /dev/null --shaper old
> --num-iterations=10000 --shaper fallback
> 0.15user 0.00system 0:00.15elapsed 99%CPU (0avgtext+0avgdata 12976maxresident)k
> 0inputs+0outputs (0major+899minor)pagefaults 0swaps

I see, compared to other fonts Amiri is considerably slow; Scheherazade
is 11 times faster, and Arabic Typesetting is 2.5 times faster!

The huge number of lookups is a result of the excessive use of
contextual substitutions (partly because of my ideological avoidance of
ligatures), but I have some 6000 glyphs now, converting those into
ligatures can easily reach number of glyphs limits.

Regards,
Khaled



More information about the HarfBuzz mailing list