[cairo] [Patch] Surface cache
jorn at openedhand.com
Mon Jan 29 08:56:49 PST 2007
Last month, Xan xtraced cairo text drawing (using xlib), and noticed
that cairo creates (and afterward destroys) a 1x1 pixmap (a cairo
surface) every time it draws some text. Xft doesn't do this.
Carl and Behdad suggested ways to, like Xft, cache surfaces so as not to
have to recreate them all the time.
As suggested by Carl in the same thread, I first investigated
per-pattern caching of acquired surfaces. This didn't work as patterns
mostly get copied before their surfaces are requested.
Attached patch adds a simple 16-entry static cache to
_cairo_pattern_acquire_surface_for_solid(). It still needs work, however
this already yields a speedup of 12% when drawing text using GTK+
2.10, exceeding the performance of GTK+ 2.6. Yay!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2046 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070129/cdd677ac/cairo-surface-cache.bin
More information about the cairo