cache results of system font lookups on Windows

RESOLVED FIXED in Firefox 55

Status

()

Core
Widget: Win32
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

(Blocks: 1 bug, {perf})

unspecified
mozilla55
x86
Windows 10
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

(Whiteboard: [qf:p1])

Attachments

(2 attachments)

(Assignee)

Description

3 months ago
Profiling bug 1118086 on Windows shows that about 8% of the time in the big pause in the parent process to render a large select is time spent in mozilla::LookAndFeel::GetFont.  See the profile in https://perfht.ml/2qYJjqQ .

(Contrast with Linux, where time was spent in GetWidgetPadding / GetWidgetBorder; see bug 1367576.)

Caching the results of these repeated system font lookups should be a performance win, and should be pretty straightforward.
(Assignee)

Comment 1

3 months ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=84b0b66b3f46ee147a75f44d9a5dbfb7485d15f9&group_state=expanded
(Assignee)

Comment 2

3 months ago
Created attachment 8875806 [details] [diff] [review]
Use override keyword in windows nsLookAndFeel header

MozReview-Commit-ID: 8bwmXmBFZB4
Attachment #8875806 - Flags: review?(jmathies)
(Assignee)

Comment 3

3 months ago
Created attachment 8875807 [details] [diff] [review]
Cache results of Windows system font lookups

I haven't really tested that this fixes the performance problem observed
in a profile without the patch because the steps to use the Gecko
Profiler on local builds on Windows are rather complicated.

MozReview-Commit-ID: FmGFs2Cvquv
Attachment #8875807 - Flags: review?(jmathies)
(Assignee)

Comment 4

3 months ago
(The instructions for the "rather complicated" bit are: https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler_and_Local_Symbols_on_Windows , for what it's worth.)
Whiteboard: [qf] → [qf:p1]

Updated

2 months ago
Attachment #8875806 - Flags: review?(jmathies) → review+

Updated

2 months ago
Attachment #8875807 - Flags: review?(jmathies) → review+
(Assignee)

Comment 5

2 months ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/aa3557e8515c8a8a1cbab8f5a5614476cc68ffe6
Bug 1371157 - Use override keyword in windows nsLookAndFeel header.  r=jimm

https://hg.mozilla.org/integration/mozilla-inbound/rev/70c026121670bd42e43bb87334fec1fd848b77d9
Bug 1371157 - Cache results of Windows system font lookups.  r=jimm

Comment 6

2 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/aa3557e8515c
https://hg.mozilla.org/mozilla-central/rev/70c026121670
Status: ASSIGNED → RESOLVED
Last Resolved: 2 months ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
(Assignee)

Comment 7

2 months ago
I verified that it fixed what I expected by reprofiling in today's nightly.

In today's nightly, 7ms are spent inside of ComputeFontData: https://perfht.ml/2svcp5g

Whereas in the profile from comment 0, that was 172ms: https://perfht.ml/2suzJAk of which 159ms was spent inside nsRuleNode::ComputeSystemFont (compared to 0 in today's nightly).
You need to log in before you can comment on or make changes to this bug.