The default bug view has changed. See this FAQ.

optimize gfxFontGroup::FindFontForChar for the most common case, and lift array Length() accesses out of other loops in font code

RESOLVED FIXED in mozilla16

Status

()

Core
Graphics: Text
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

(Blocks: 1 bug)

unspecified
mozilla16
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Created attachment 632294 [details] [diff] [review]
optimize access to the mFonts array in gfxFontGroup

There's no reason for gfxFontGroup::FontListLength to be virtual; and we can reduce the overhead of accessing the mFonts array by getting the Length and Elements pointer into local variables instead of repeatedly using the nsTArray methods and GetFontAt() within loops.
Attachment #632294 - Flags: review?(jdaggett)
(Assignee)

Comment 1

5 years ago
Created attachment 634600 [details] [diff] [review]
patch, optimize common case in gfxFontGroup::FindFontForChar, and various other loops in font code

Extending this bug to cover more cases where we can optimize by pulling nsTArray::Length() accesses out of loops, etc., and more importantly, optimize gfxFontGroup::FindFontForChar by handling the most common case (a normal character available in the first font of the group) at the beginning of the function.

When reflowing the tinderbox log mentioned in bug 762710 comment 0 on my MBPro, this patch reduces the total time spent in gfxFontGroup::FindFontForChar (as recorded by Instruments) from about 650-700ms to around 260ms.
Assignee: nobody → jfkthame
Attachment #632294 - Attachment is obsolete: true
Attachment #632294 - Flags: review?(jdaggett)
Attachment #634600 - Flags: review?(jdaggett)
(Assignee)

Updated

5 years ago
Blocks: 762710
(Assignee)

Updated

5 years ago
Summary: optimize access to the mFonts array in gfxFontGroup → optimize gfxFontGroup::FindFontForChar for the most common case, and lift array Length() accesses out of other loops in font code
Attachment #634600 - Flags: review?(jdaggett) → review+
(Assignee)

Comment 2

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/5c22222c03a5
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/5c22222c03a5
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Depends on: 769475
You need to log in before you can comment on or make changes to this bug.