Closed Bug 502821 Opened 15 years ago Closed 15 years ago

Investigate if Thebes is enumerating all system fonts on startup, and if that could hurt Ts

Categories

(Core :: Graphics, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 491283

People

(Reporter: mak, Unassigned)

References

Details

(Keywords: perf, Whiteboard: Ts)

While investigating bug 501605 on support mozilla com was noted some user is seeing accesses to c:/windows/fonts on startup and enumeration of all the fonts.
The only method i see doing that is gfxWindowsPlatform::FindFonts().
Are all fonts really read at browser startup? Will that hurt performances/Ts if the user has thousands of fonts installed?

See https://bugzilla.mozilla.org/show_bug.cgi?id=501605#c75
Blocks: 479078
Flags: wanted1.9.1.x?
Whiteboard: Ts
Not sure what this bug is intended to be.  Yes, we enumerate fonts at startup but we don't read metrics or look a cmaps (i.e. things that take time) until later.

http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/src/gfxWindowsPlatform.cpp#322

*After* startup, the all fonts in the system are enumerated and their cmap read in.  This is done in intervals, n fonts at a time.

Mac OS X:
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/src/gfxQuartzFontCache.mm#863

Windows:
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/src/gfxWindowsPlatform.cpp#348

If for some reason a user on startup hits a page that causes system font fallback (i.e. the page includes a character for which a glyph doesn't exist in either the font list or the default font), then fallback will occur and font cmaps will be checked one-by-one in gfxWindowsPlatform::FindFontForChar:

http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/src/gfxWindowsPlatform.cpp#627

If you think there's a bug/inefficiency here, please set up a testcase that reproduces the problem.
I don't know if there's an inefficiency in code, i filed the bug for completeness since there is investigation going on on startup taking long times for some user, and some user reported removing many fonts (1500) from his fonts folder has greatly reduced his Fx startup times.
Maybe it's just that enumerating all fonts at startup could be slow if the user has thousands of fonts and a not-so-fast I/O system. Does that happen in a separate thread?
Sorry, i don't know Thebes code enough to investigate the issue, so is up to developers knowing it to check if the process could get better, or mark bug the as WFM. I could at a maximum add 10 thousands fonts to a win box and see if Ts is hit using standalone Talos.
(In reply to comment #2)
> some user reported removing many fonts (1500) from his fonts
> folder has greatly reduced his Fx startup times.

Which platform does this report come from? This relates to very platform-specific code, and the impact of having large numbers of fonts may vary significantly between platforms.
Windows platform, i don't have further informations unfortunatly
Marco, do you have rough numbers for the startup time differences?  That is, with 100 fonts startup time takes xxx seconds but with 1500 fonts it takes yyy seconds? And on Vista or XP?
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
hm, if you dupe this to bug 491283, please confirm that bug (i would at duped the opposite way), it's quite clear we enumerate all fonts in some situation and that could be slow for some user, so no need to stay unconfirmed imo.
Flags: wanted1.9.1.x?
You need to log in before you can comment on or make changes to this bug.