summaryrefslogtreecommitdiff
path: root/src/cairo-gstate-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-05-27 14:54:34 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-02 15:13:44 +0100
commitdc083ab30a5b781e205354c525ee054982364abd (patch)
treea109cec53e26a949056cc3fa6ed75782486016dd /src/cairo-gstate-private.h
parentfda89c56ff484a8cd33cd780e8b9396d3538284d (diff)
downloadcairo-dc083ab30a5b781e205354c525ee054982364abd.tar.gz
[cairo] Track the MRU scaled font
When observing applications two patterns emerge. The first is due to Pango, which wraps each glyph run within a context save/restore. This causes the scaled font to be evicted after every run and reloaded on the next. This is caught by the MRU slot on the cairo_scaled_font_map and prevents a relatively costly traversal of the hash table and holdovers. The second pattern is by applications that directly manage the rendering of their own glyphs. The prime example of this is gnome-terminal/vte. Here the application frequently alternates between a few scaled fonts - which requires a hash table retrieval every time. By introducing a MRU slot on the gstate we are able to directly recover the scaled font around 90% of the time. Of 110,000 set-scaled-fonts: 4,000 were setting the current font 96,000 were setting to the previous font 2,500 were recovered from the MRU on the cairo_scaled_font_map 7,500 needed a hash retrieval which compares to ~106,000 hash lookups without the additional MRU slot on the gstate. This translates to an elapsed time saving of ~5% when replaying a gnome-terminal trace using the drm backend.
Diffstat (limited to 'src/cairo-gstate-private.h')
-rw-r--r--src/cairo-gstate-private.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
index 25900482c..cb278e806 100644
--- a/src/cairo-gstate-private.h
+++ b/src/cairo-gstate-private.h
@@ -50,6 +50,7 @@ struct _cairo_gstate {
cairo_font_face_t *font_face;
cairo_scaled_font_t *scaled_font; /* Specific to the current CTM */
+ cairo_scaled_font_t *previous_scaled_font; /* holdover */
cairo_matrix_t font_matrix;
cairo_font_options_t font_options;