Closed Bug 825875 Opened 12 years ago Closed 12 years ago

shape long words directly into the text-run instead of via the per-font word caches

Categories

(Core :: Graphics: Text, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

Currently, we divide text runs into "words" (space-separated fragments, really), and cache the results of shaping these "words" in each font's shaped-word cache. However, intuition suggests and telemetry confirms that as word length increases, the effectiveness of this word-caching scheme drops off, as long "words" are less likely to be frequently reused. Checking statistics from metrics.mozilla.com, the word-cache hit rate drops from around 90% for single-letter words, through 50% for words of 4 letters, down to less than 20% for 30-letter words (and so on...) I'd suggest, therefore, that it is not worth caching the shaped-glyph data for long words, where I'm thinking "long" might be around 30 characters, though we could do some more instrumentation to determine the exact cut-off point where the decreasing hit rate means there's no performance benefit to the cache. With the refactoring proposed in bug 825871, we'll easily be able to bypass the word cache for any fragments that exceed a threshold length, and shape them directly into the target textrun instead. (Note that there is some perf cost to shaping via the cache, apart from the added RAM footprint, as we have to allocate the gfxShapedWord object -- and potentially additional objects for detailed-glyph data -- and then copy the glyph data from the shaped-word into the text-run, so for an item that is *never* reused, shaping directly into the text-run will actually be a perf win.)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 1522857
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: