Investigate name enumeration time at startup

RESOLVED FIXED in mozilla23



8 years ago
6 years ago


(Reporter: jtd, Assigned: jfkthame)


(Blocks: 1 bug)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [Snappy:P1])


(3 attachments)



8 years ago
Telemetry numbers seem to indicate that a fair number of calls to InitOtherFamilyNames() and InitFaceNameLists() take a significant amount of time.

Telemetry data:


See other comments in bug 600713.
I looked through Nightly 22 chrome-hang data from two weeks in March and I found that font operations are the second most common cause of multi-second main thread hangs after plugins.

I've attached the top chrome hang stacks relevant to this bug. If I'm interpreting these stacks correctly, it's mostly a case of a lot of disk I/O being done on the main thread. Can we do anything about these?
Whiteboard: [Snappy:P1]


6 years ago
Blocks: 859558
In some cases this is triggered by the use of @font-face with src:local, which causes us to load all the names so that we can correctly implement the font name matching. Maybe instead of blocking on the name-loading, we should fall back to the next in the font-family list, and then refresh once the font names are available, like we do with downloadable fonts.

In other cases, it seems to be caused by the font info loader that we run shortly after startup. This is intended to preload font name and cmap info so that we -won't- block on these things when we actually need to use the fonts. But if disk access is slow (contention with other i/o?) and/or font files are large, maybe loading the info for one group of fonts is taking too long.

One thing we can try here is to read info for fewer fonts at a time, so that we return to the main event loop more frequently. Note that the code currently operates in "slices" of 10, but that actually represents 10 font -families-, which may be 40 individual faces (or even more, in the case of DirectWrite).

The first patch here simply moves the constants that control the font-loader into prefs, so that we (or QA, or users) can more easily adjust them to tune the behavior; and then the second patch adjusts them to read the fonts in smaller "slices"; I suggest we try this and see if it has any visible effect on the frequency of these hangs.
Assignee: jdaggett → jfkthame


6 years ago
Attachment #740247 - Flags: review?(jdaggett) → review+


6 years ago
Attachment #740248 - Flags: review?(jdaggett) → review+

Comment 5

6 years ago
I think the real solution here will be to move the font loader off the main thread but that's going to take a significant amount of refactoring so for now this seems fine.  There will still be situations where a hang will occur (e.g. with crappy netbooks at cold startup when startup occurs shortly after a system restart) but hopefully we'll have more chromehang data to distinguish these cases from cases.
Agreed, that's more like a real solution - this is just a band-aid that is intended to mitigate the problem somewhat, at least for some of the chrome-hang cases.
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.