Last Comment Bug 707959 - add telemetry to determine effectiveness of font and shaped-word caching
: add telemetry to determine effectiveness of font and shaped-word caching
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout: Text (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla13
Assigned To: John Daggett (:jtd)
:
:
Mentors:
Depends on: 703100
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-06 09:06 PST by Jonathan Kew (:jfkthame)
Modified: 2012-02-15 09:17 PST (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch, add word cache telemetry probes to GetShapedWord (1.68 KB, patch)
2012-02-13 21:30 PST, John Daggett (:jtd)
no flags Details | Diff | Splinter Review
patch, add word cache telemetry probes to GetShapedWord and font cache lookup (3.12 KB, patch)
2012-02-14 18:12 PST, John Daggett (:jtd)
roc: review+
Details | Diff | Splinter Review
followup, move font cache telemetry into gfxFontCache::Lookup (2.69 KB, patch)
2012-02-14 23:19 PST, Jonathan Kew (:jfkthame)
roc: review+
Details | Diff | Splinter Review

Description Jonathan Kew (:jfkthame) 2011-12-06 09:06:48 PST
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.
Comment 1 Jonathan Kew (:jfkthame) 2011-12-06 13:38:40 PST
Once bug 703100 lands, we can easily instrument this by hooking in to gfxFont::GetShapedWord.
Comment 2 Nathan Froyd [:froydnj] 2012-02-03 07:04:17 PST
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.
Comment 3 John Daggett (:jtd) 2012-02-13 21:30:53 PST
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.
Comment 4 John Daggett (:jtd) 2012-02-14 18:12:35 PST
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.
Comment 5 John Daggett (:jtd) 2012-02-14 22:39:34 PST
Pushed to mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/f8ce0b7ebd80
Comment 6 Jonathan Kew (:jfkthame) 2012-02-14 23:19:20 PST
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 7 John Daggett (:jtd) 2012-02-15 00:02:30 PST
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... ;)
Comment 8 Jonathan Kew (:jfkthame) 2012-02-15 02:19:14 PST
Pushed followup:
https://hg.mozilla.org/integration/mozilla-inbound/rev/90213a7ffc24

Note You need to log in before you can comment on or make changes to this bug.