summaryrefslogtreecommitdiff
path: root/src/cairo-hash-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-21 15:04:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-01-29 10:10:39 +0000
commitaaec63d48386ec825cd4d6e67b6adf7c5fd3b167 (patch)
tree6b13aa509a009acd55c7e4a15b0ff6fd45f0012d /src/cairo-hash-private.h
parent54f6a49ebb18cf396823d0d70b95e4e264142171 (diff)
downloadcairo-aaec63d48386ec825cd4d6e67b6adf7c5fd3b167.tar.gz
[scaled-font] Global glyph cache
Currently glyphs are cached independently in each font i.e. each font maintains a cache of up to 256 glyphs, and there can be as many scaled fonts in use as the application needs and references (we maintain a holdover cache of 512 scaled fonts as well). Alternatively, as in this patch, we can maintain a global pool of glyphs split between all open fonts. This allows a heavily used individual font to cache more glyphs than we could allow if we used per-font glyph caches, but at the same time maintains fairness across all fonts (by using random replacement) and provides a cap on the maximum number of global glyphs. The glyphs are allocated in pages, which are cached in the global pool. Using pages means we can exploit spatial locality within the font (nearby indices are typically used in clusters) to reduce frequency of small allocations and allow the scaled font to reserve a single MRU page of glyphs. This caching dramatically reduces the cairo overhead during the cairo-perf benchmarks, and drastically reduces the number of allocations made by the application (for example browsing multi-lingual site with firefox).
Diffstat (limited to 'src/cairo-hash-private.h')
-rw-r--r--src/cairo-hash-private.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h
index a0be097a8..8ab085822 100644
--- a/src/cairo-hash-private.h
+++ b/src/cairo-hash-private.h
@@ -68,6 +68,10 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table,
cairo_hash_entry_t *key);
cairo_private void *
+_cairo_hash_table_steal (cairo_hash_table_t *hash_table,
+ cairo_hash_entry_t *key);
+
+cairo_private void *
_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table,
cairo_hash_predicate_func_t predicate);