If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

reduce size of CSS style rules

RESOLVED FIXED in mozilla2.0b7

Status

()

Core
CSS Parsing and Computation
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

({footprint})

Trunk
mozilla2.0b7
footprint
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

jseward showed me some data today showing how much memory CSS style rules were taking up.  While there's more we can do to reduce their size, I noticed two very easy wins.
Created attachment 474991 [details] [diff] [review]
patch 1: turn mWasMatched into a bit, stealing a bit from mLineNumber
Attachment #474991 - Flags: review?(bzbarsky)
Created attachment 474993 [details] [diff] [review]
patch 2: eliminate all virtual methods from nsCSSRule

nsCSSRule doesn't really need a vtable pointer, and most of its methods didn't need to be virtual in the first place.  The only ones that really did were AddRef and Release, which I just pushed down to derived classes.  That's a slight codesize increase, but one we really ought to find better solutions to...
Attachment #474993 - Flags: review?(bzbarsky)
(as mentioned yesterday to bz) I also have a rudimentary hot-field
profiler, which might help in finding these kinds of opportunities.
I'll see if I can get some results from it today.
Comment on attachment 474991 [details] [diff] [review]
patch 1: turn mWasMatched into a bit, stealing a bit from mLineNumber

I believe MSVC won't pack bitfields of incompatible type.  So you need to make mWaasMatched a PRUint32 as well.

r=me with that.
Attachment #474991 - Flags: review?(bzbarsky) → review+
Comment on attachment 474993 [details] [diff] [review]
patch 2: eliminate all virtual methods from nsCSSRule

r=me.
Attachment #474993 - Flags: review?(bzbarsky) → review+
Attachment #474991 - Flags: approval2.0?
Attachment #474993 - Flags: approval2.0?
Attachment #474991 - Flags: approval2.0? → approval2.0+
Attachment #474993 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/ebb67011bb43
http://hg.mozilla.org/mozilla-central/rev/d09dcf95a050
http://hg.mozilla.org/mozilla-central/rev/c12c5e990eda
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b7
The final patch was:
 * the addition of NS_FINAL_CLASS per discussion with bz
 * a missing virtual on ~nsCSSGroupRule that I noticed when doing that
Depends on: 601437
You need to log in before you can comment on or make changes to this bug.