Closed Bug 1129853 Opened 10 years ago Closed 10 years ago

[Header] We should cache the results from measureText

Categories

(Firefox OS Graveyard :: Gaia::Components, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: julienw, Unassigned)

Details

When overflowing, we recalculate the font size using more space; we end up measuring the same text twice. We should cache the results from measureText in the font-fit library. Another possibility is to make fontFit run the algorithm instead: * pass an array of configs to the fontFit algorithm (a config is: available space, min size, max size) * fontFit would run measureText iteratively until it fits one of the config. * fontFit would return the fontSize and which config it took
This would win ~3ms max from what i see (and I tried using a Map, the perf is actually worse). Closing.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
No longer depends on: 1129852
You need to log in before you can comment on or make changes to this bug.