Closed Bug 1583005 Opened 5 years ago Closed 5 years ago

Major performance regression with gfx.e10s.font-list.shared enabled

Categories

(Core :: Graphics: Text, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- unaffected
firefox69 --- unaffected
firefox70 --- unaffected
firefox71 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: perf, regression)

Attachments

(1 file)

STR

  1. create a fresh profile
  2. start Nightly (note that initial built-in page loads quickly)
  3. go to about:config and set gfx.e10s.font-list.shared to true
  4. restart browser

ACTUAL RESULTS
Initial built-in page (all pages really) loads very slowly.
All pages takes ~10 seconds to render anything.

This is a regression in the last week or so.
Nightly 71.0a1 (2019-09-21) (64-bit) on Linux.

Huh, that's curious.... I wonder if one of the recent font-list bugfixes is causing unexpected levels of cache churn or something. Pinpointing when it regressed would be a first step.

This appears to be a regression from Lee's patches in bug 1547063, though I'm not yet sure exactly why. Maybe profiling will show a smoking gun....

Regressed by: 1547063

According to https://perfht.ml/31Jocez, we seem to be spending a crazy-large amount of time (43 seconds, in this profile) doing fontconfig stuff from within gtk, called from nsLookAndFeel::EnsureInit. It seems like fontconfig may be deciding it needs to reinitialize its whole configuration on every call, or something like that.

It's not obvious to me why this would be dependent on the gfx.e10s.font-list.shared setting, but apparently it is. Lee, any thoughts on what might be going on here?

Flags: needinfo?(lsalzman)

OK, it looks to me like we need to ensure that each content process has done something to cause fontconfig initialization before we start making gtk calls from nsLookAndFeel. Otherwise (for reasons I don't really understand) we run into this pathological situation when gtk wants to touch font-related stuff.

Turning on the shared font list triggers this because the content processes no longer do any fontconfig stuff during InitSharedFontListForPlatform. It looks like we can avoid the issue by hoisting the setting of mLastConfig = FcConfigGetCurrent() up to where it happens in all processes (not just the parent); this should be pretty harmless. (It also means that if we eventually want access to the configuration in child processes, which we may need for better fontconfig integration anyhow, it'll be there for us.)

Well, just looking at the backtrace and the Fontconfig source code, even though this seems like a very unlikely scenario, this could happen:

FcConfigSubstituteWithPat calls FcConfigGetCurrent/FcConfigEnsure, and FcConfigEnsure in the multi-threaded case has a retry/spin-lock guarding the initialization of this, which could hypothetically be where the FcConfigDestroy comes from. One way to test this would be to call FcConfigInit (which calls FcConfigEnsure) earlier in the loading process to make sure that the default FcConfig gets initialized without any contention.

One of the changes I made in my Cairo cleanups was to remove the querying of a dummy Cairo-FT font to get the FT_Library, since now we do all FT_Face creation outside of Cairo, we just create our own instance of an FT_Library. Doing the call to FcConfigInit around where that used to be seems like a good way to test this hypothesis?

Flags: needinfo?(lsalzman)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/745fe3b9c450 Ensure the fontconfig configuration is initialized in all processes (by calling FcConfigGetCurrent) before potential gtk access. r=lsalzman
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → jfkthame
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: