reorder fields in gfxFontStyle for more efficient packing

RESOLVED FIXED in mozilla14

Status

()

Core
Graphics
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

Trunk
mozilla14
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 605533 [details] [diff] [review]
patch, optimize order of fields in gfxFontStyle to save space

The attached patch rearranges fields so that sizeof(gfxFontStyle) drops from 48 to 40 bytes on a 64-bit OS X build. Given that we can easily have thousands of gfxFontStyle records alive at any one time, this seems like a worthwhile saving.
Attachment #605533 - Flags: review?(jdaggett)

Comment 1

6 years ago
Comment on attachment 605533 [details] [diff] [review]
patch, optimize order of fields in gfxFontStyle to save space


r+ with fix noted below.

> +    // The style of font (normal, italic, oblique)
> +    PRUint8 style : 6;

This should be 'style : 2', there's no real reason to be doing the
padding ourselves, this leads to bytes inadvertently being added when
new fields are added, as seems to be the case in the original 'style :
7' definition.
Attachment #605533 - Flags: review?(jdaggett) → review+
(Assignee)

Comment 2

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/5f438ea9ded4
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/5f438ea9ded4
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Comment on attachment 605533 [details] [diff] [review]
patch, optimize order of fields in gfxFontStyle to save space

Review of attachment 605533 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/thebes/gfxFont.h
@@ +165,5 @@
> +    // Say that this font is used for print or print preview.
> +    bool printerFont : 1;
> +
> +    // The style of font (normal, italic, oblique)
> +    PRUint8 style : 6;

Note that MSVC apparently only packs members of the same type.
You need to log in before you can comment on or make changes to this bug.