Closed Bug 735439 Opened 12 years ago Closed 12 years ago

reorder fields in gfxFontStyle for more efficient packing

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

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 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+
https://hg.mozilla.org/mozilla-central/rev/5f438ea9ded4
Status: NEW → RESOLVED
Closed: 12 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.

Attachment

General

Created:
Updated:
Size: