[HarfBuzz] Amiri and OpenType performance

Behdad Esfahbod behdad at behdad.org
Mon Apr 15 12:59:31 PDT 2013


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'll be looking for ideas to speed these up.  But given the popularity that
Amiri is gaining on the web, would be nice to try to optimize on both sides.

behdad




> Regards,
> Khaled
> 

-- 
behdad
http://behdad.org/



More information about the HarfBuzz mailing list