Closed Bug 1819275 Opened 3 years ago Closed 2 years ago

[macOS] Attempt to avoid the main thread being blocked on font-list initialization during startup

Categories

(Core :: Graphics: Text, defect)

defect

Tracking

()

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(2 files)

See profile: https://share.firefox.dev/3ZpfakC

This is a profile of launching a local (opt) mozilla-central build to about:blank.

It's noticeable here that during startup, the main thread is blocked (idle) for around 140ms while it waits for the InitFontList thread to complete.

We register the gfxUserFontSet instance with the platform font list so that it can
be updated when necessary, if the font list changes such that src:local rules might
resolve differently. But if src:local is not used, the font set does not need to
be aware of the platform list, so we can make the connection only when a local
lookup is actually present.

This avoids blocking the main thread during startup, e.g. when we create a font set
for the -moz-bullet dataURI font that is part of the UA stylesheet.

Depends on D171205

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

This method does not rely on any instance data, it just depends on system font APIs.
So it can be declared as static and used regardless of whether the platform font list
is fully initialized.

This avoids blocking on platform font list initialization when the widget code
calls LookupSystemFont during startup.

Depends on D171206

Attachment #9320234 - Attachment description: Bug 1819275 - Nake gfxMacPlatformFontList::LookupSystemFont a static method. r=#gfx-reviewers → Bug 1819275 - Make gfxMacPlatformFontList::LookupSystemFont a static method. r=#gfx-reviewers

The severity field is not set for this bug.
:lsalzman, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Severity: -- → S3
Flags: needinfo?(lsalzman)

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:jfkthame, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(jfkthame)
Flags: needinfo?(lsalzman)

I was seeing some test failures that proved difficult to resolve; still hoping to get back to this but it can't land as-is.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/098ce7fab046 Don't unconditionally access (and initialize) the platform font list from gfxUserFontSet; it is only required for src:local faces. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/f1cebda4f6d6 Make gfxMacPlatformFontList::LookupSystemFont a static method. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
Blocks: 1856465

(In reply to Pulsebot from comment #6)

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/098ce7fab046
Don't unconditionally access (and initialize) the platform font list from
gfxUserFontSet; it is only required for src:local faces.
r=gfx-reviewers,lsalzman
https://hg.mozilla.org/integration/autoland/rev/f1cebda4f6d6
Make gfxMacPlatformFontList::LookupSystemFont a static method.
r=gfx-reviewers,lsalzman

== Change summary for alert #39764 (as of Tue, 03 Oct 2023 10:59:02 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
7% sessionrestore_many_windows macosx1015-64-shippable-qr e10s fission stylo webrender-sw 847.21 -> 792.17
5% sessionrestore macosx1015-64-shippable-qr e10s fission stylo webrender 1,096.92 -> 1,043.25
5% sessionrestore_no_auto_restore macosx1015-64-shippable-qr e10s fission stylo webrender 1,113.17 -> 1,061.42
4% sessionrestore macosx1015-64-shippable-qr e10s fission stylo webrender 1,086.25 -> 1,046.92

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=39764

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: