We have caches with timed expiration for gfxFont instances and gfxTextRuns containing shaped glyph data (to be replaced by gfxShapedWord caches in bug 703100). We should add telemetry to help us determine whether the expiration times we're using are sensible. If they're too short, we may be frequently discarding things from the caches and then re-creating them almost immediately, which hurts performance; if they're too long, we may be using up memory for minimal perf benefit. As a first step, we could report the cache hit rates; then we could change the timeouts on nightly builds for a few days, and see what effect this has. Another metric that might be interesting would be to report the "age" of cache entries that are destined for eviction but then get reset because they're used again.
Once bug 703100 lands, we can easily instrument this by hooking in to gfxFont::GetShapedWord.
This is the sort of thing that Telemetry A/B infrastructure would be perfect for. CC'ing Taras, who was looking for an excuse to use those bits.
Created attachment 596916 [details] [diff] [review] patch, add word cache telemetry probes to GetShapedWord Add two probes, one for overall lookups the other just for hits. Counts divided up based on length.
Created attachment 597268 [details] [diff] [review] patch, add word cache telemetry probes to GetShapedWord and font cache lookup Revised to include lookup/hit per length and per script. Also include font cache hits.
Pushed to mozilla-inbound https://hg.mozilla.org/integration/mozilla-inbound/rev/f8ce0b7ebd80
Created attachment 597316 [details] [diff] [review] followup, move font cache telemetry into gfxFontCache::Lookup The patch that just landed here doesn't instrument font cache lookups on Linux in gfxPangoFonts.cpp. (Or on OS/2, if we care...) I think it'd make more sense to put the telemetry probe into gfxFontCache::Lookup itself, instead of duplicating it at each call site.
Comment on attachment 597316 [details] [diff] [review] followup, move font cache telemetry into gfxFontCache::Lookup Sounds fine to me. Wouldn't want to miss the all those font lookups on OS/2... ;)
Pushed followup: https://hg.mozilla.org/integration/mozilla-inbound/rev/90213a7ffc24