Closed Bug 764005 Opened 12 years ago Closed 12 years ago

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

Categories

(Core :: Graphics: Text, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file, 1 obsolete file)

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)
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)
Blocks: 762710
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+
https://hg.mozilla.org/mozilla-central/rev/5c22222c03a5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 769475
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: