[cairo] text measurement in perf?
Baz
brian.ewins at gmail.com
Fri May 25 18:31:47 PDT 2007
On 26/05/07, Baz <brian.ewins at gmail.com> wrote:
> and after the fix:
> 43.8% _cairo_cache_insert
> 41.2% _cairo_hash_table_insert
That second line should say _cairo_hash_table_lookup.
Daft question time...
I got to wondering what's going on here and found something that might
be worth fixing. In my test I was trying to achieve a cache miss every
time; it turns out that a cache miss is about 8 times slower than just
measuring the text (!). However, we're actually missing the cache
twice; once in cairo_cache_insert and once in
_cairo_hash_table_lookup . What's interesting about this is that we're
holding the scaled font mutex at the time, so the insert is safe[1].
I added an unsafe_insert op to cairo-hash and cairo-cache, and called
it from _cairo_scaled_glyph_lookup; sure enough, text measurement is
now nearly twice as fast. Does anyone know how common these cache
misses are in real life? How does the miss/measure time compare on
other platforms?
-Baz
[1] we're not holding the mutex around the lookup in
cairo_scaled_font_device_extents, or cairo_scaled_font_show_glyphs.
I'm not sure why not though.
More information about the cairo
mailing list