[cairo] Global glyph cache
chris at chris-wilson.co.uk
Wed Mar 4 00:22:26 PST 2009
On Tue, 2009-03-03 at 21:08 -0500, Jeff Muizelaar wrote:
> It looks like the new global glyph cache is responsible for a 10MB
> increase in memory usage on a firefox tp run. This increase is keeping
> me from merging cairo trunk into mozilla-central.
When you mentioned a RSS regression a while ago, I feared this might be
it, but I saw no increase with my normal firefox usage. So I waited...
> Looking through the code this seems expected. Given a cache page size of
> 17936 bytes we can get up 512*17936 = 9183232 bytes in the cache. In
> addition, we could have glyph pages attached to scaled_fonts which would
> add another 256 pages bringing the maximum up to 13795584 or 13.1 MB.
That's a valid assessment for cairo's internal caching, but an
underestimate since firefox maintains a much larger font cache.
> It also looks like some of the cache freezing/thawing might be broken
> because even after adjusting MAX_GLYPH_PAGES_CACHED to 2 I've still seen
> around 400 active glyph pages during a tp run.
I'd love to get my hands on a cairo-trace for a tp run. My firefox usage
doesn't even come close. On that subject, would we be able to
redistribute such a benchmark along with cairo-perf? I really want to
complement our collection of mostly synthetic perf cases with a few
complex real-world tests.
For the global glyph cache there are two tuneables; number of
glyph-per-page and number of pages in global cache (ignoring any
apparent bugs ;-).
Using the spatial clustering of glyph indices is a big win (keeping the
mru page bypasses most glyph cache lookups - they're also kept with the
font and not in the cache so might explain why we have move active pages
than nominally allowed by the cache) so I don't want to remove that
entirely, but it can be shrunk -- it just requires a good representative
benchmark for which to tune.
More information about the cairo