Reduce size of gfxTextRun by optimizing glyphrun storage

RESOLVED FIXED in Firefox 55

Status

()

Core
Graphics: Text
RESOLVED FIXED
9 months ago
9 months ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

unspecified
mozilla55
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

9 months ago
See https://dxr.mozilla.org/mozilla-central/rev/2cca333f546f38860f84940d4c72d7470a3410f4/gfx/thebes/gfxTextRun.h#760-762.

I propose to reduce the size of gfxTextRun by replacing the AutoTArray<GlyphRun,1> (32 bytes in a 64-bit build) with a union that holds either a single GlyphRun *or* an nsTArray<GlyphRun>, with a flag elsewhere in gfxTextRun to record which is currently present (we have a spare padding byte available for that). There will be a bit of overhead in AddGlyphRun when transitioning from a single glyphrun (stored inline) to two glyphruns (in an array), but that will be essentially equivalent to the work AutoTArray does when its autobuffer oveflows.

This should reduce the size of gfxTextRun by 16 bytes, yet have the same allocation behavior as at present: when there's a single GlyphRun, it is stored directly in the textrun with no separate heap allocation, and when there are multiple glyph runs, we have to allocate heap storage for the array (just as the autoarray does when its one-element buffer overflows).
(Assignee)

Comment 1

9 months ago
Created attachment 8862944 [details] [diff] [review]
Optimize GlyphRun storage strategy in gfxTextRun, to reduce the overall size of the gfxTextRun object
(Assignee)

Updated

9 months ago
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(Assignee)

Updated

9 months ago
Attachment #8862944 - Flags: review?(jmuizelaar)
Attachment #8862944 - Flags: review?(jmuizelaar) → review+
(Assignee)

Comment 3

9 months ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/dca52e4ed76197ec3e3629e659020c3d5c8d81bb
Bug 1360620 - Optimize GlyphRun storage strategy in gfxTextRun, to reduce the overall size of the gfxTextRun object. r=jrmuizel

Comment 4

9 months ago
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dca52e4ed761
Optimize GlyphRun storage strategy in gfxTextRun, to reduce the overall size of the gfxTextRun object. r=jrmuizel

Comment 5

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

Updated

9 months ago
Depends on: 1361648
(Assignee)

Updated

9 months ago
Depends on: 1361395
You need to log in before you can comment on or make changes to this bug.