[cairo] text measurement in perf?

Behdad Esfahbod behdad at behdad.org
Mon May 28 17:52:16 PDT 2007

On Sat, 2007-05-26 at 13:46 -0400, Baz wrote:
> Turs out we are holding the mutex everywhere needed for this
> optimisation to work. Test and patch available at:
> http://gitweb.freedesktop.org/?p=users/brianewins/cairo;a=shortlog;h=patches/glyph-cache
> The test manages to get uncached metrics for ATSUI, FT, havent tried
> it on windows. I see around 1.7x speedup fetching uncached metrics
> with this patch, with both font systems. Obviously this won't make
> much difference to simple apps with western languages only, since
> cache misses will be rare; but it will help displaying non-western
> scripts. Comments welcome.
> The penalty for a cache miss still seems incredibly high though - it
> may well be worth trying a warm cache, just cache entries for the
> first 255 glyph ids with no metrics attached, though the setup cost
> might not be worth it.

This is all very interesting.  Keep them coming!  As for the mutex
issue, I think Carl and Chris know better what the pattern there is.

The issue with non-Western languages you identify is very real, and
Federico identified that cairo-1.2 is more than an order of magnitude
slower than cairo-1.0 when dropped a huge bunch of Chinese/Japanese text
at (in his GUADEC 2006 keynote where he first finger-pointed me as his
hero, then next slide revealed the huge regression and everyone was
turning heads to see who I was..., hehe).  The change that caused it of
course was moving from a global glyph cache to a 256-per-font one.
Again, Carl has thoughts about how to fix that too.  Carl?


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list