Closed Bug 2005806 Opened 9 months ago Closed 9 months ago

StaticPresData::GetFontPrefsForLang spends time in ICU during Fenix startup

Categories

(Core :: Graphics: Text, defect)

defect

Tracking

()

RESOLVED FIXED
148 Branch
Tracking Status
firefox148 --- fixed

People

(Reporter: mstange, Assigned: mstange, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert)

Attachments

(1 file)

Profile: https://share.firefox.dev/4rOkjS5

StaticPresData::GetFontPrefsForLang spends time in uloc_addLikelySubtags_78 to figure out that we need to read the prefs ending in .x-western for geckoview.xhtml.

That document doesn't have a language set on it - will it always use en-US? Can we add a fast path to map en-US to x-western so that we don't have to engage ICU here?

Flags: needinfo?(jfkthame)

Also, the font prefs don't really matter for this document anyway because it's just a <window> with a <browser> in it and no actual text in the parent process.

During startup, when geckoview.xhtml's style is initialized, we call
GetLanguageGroup("en-US") to determine font preferences. This currently
triggers expensive ICU likely subtags data loading.

Add a fast path that directly maps "en" and "en-*" to x_western without
calling AddLikelySubtags(), since all English variants use Latin script.

This defers ICU initialization until it's actually needed for non-English
languages, improving startup performance.

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED

Before: https://share.firefox.dev/3XOt9Sj (34 samples in nsPresContext::FlushPendingMediaFeatureValuesChanged)
After: https://share.firefox.dev/3KWh8Y0 (0 samples in nsPresContext::FlushPendingMediaFeatureValuesChanged)
(After + bug 2004948: https://share.firefox.dev/3XOkX4r )

Pushed by mstange@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7af4ff603851 https://hg.mozilla.org/integration/autoland/rev/f439d65a5473 Add fast path for English in GetUncachedLanguageGroup to avoid ICU initialization. r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch

(In reply to Pulsebot from comment #4)

Pushed by mstange@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/7af4ff603851
https://hg.mozilla.org/integration/autoland/rev/f439d65a5473
Add fast path for English in GetUncachedLanguageGroup to avoid ICU
initialization. r=jfkthame

Perfherder has detected a awsy performance change from push f439d65a5473dd295c79803225fd2ee1ea19a909.

No action is required from the author; this comment is provided for informational purposes only.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
5% Base Content Explicit windows11-64-24h2-shippable fission 8,230,420.67 -> 7,798,659.33
4% Base Content Resident Unique Memory windows11-64-24h2-shippable fission 11,391,317.33 -> 10,958,506.67

Need Help or Information?

If you have any questions, please reach out to bacasandrei@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert
QA Whiteboard: [qa-triage-done-c149/b148]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: