Closed Bug 596140 Opened 14 years ago Closed 14 years ago

reduce size of CSS style rules

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Keywords: memory-footprint)

Attachments

(2 files)

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.
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+
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: