Closed Bug 105068 Opened 23 years ago Closed 23 years ago

merge mLazyState bits to save a word in slots

Categories

(Core :: XUL, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: waterson, Assigned: waterson)

References

(Blocks 1 open bug)

Details

(Keywords: memory-footprint)

Attachments

(2 files)

The mLazyState field is used by XUL generated from RDF templates. Since these nodes are all going to be ``heavyweight'' anyway, there is no reason to store this value in the ``lightweight'' part of the XUL element. (Well, the topmost node in every template also uses the lazy state, so we'd be faulting these nodes -- but the number of these nodes is extremely small.)
Blocks: 104400
Status: NEW → ASSIGNED
Keywords: footprint
Priority: -- → P3
Target Milestone: --- → mozilla0.9.6
So, when bringing up a browser window, 14 out of 1750 nsXULElement objects get their lazy state set: all of these are lightweights. There are 926 heavyweights. nsXULElement is currently (before patch) 17 words, nsXULElements::Slots is 7 words. That means are memory usage is: 1750 * 17 + 926 * 7 = 36232 words With the patch, nsXULElement is 16 words, nsXULElements::Slots is 8 words: 1750 * 16 + (926 + 14) * 8 = 35520 words That's a net savings of 712 words, or about 2%. Hmm. Maybe we should stuff this state into the low bits of a pointer somewhere, so we'd get 1750 * 16 + (926 + 14) * 7 = 34580 words to save 1652 words, or about 4.5%.
Bah, that'd be great to do, but I'll do it once I clean out all the other cruft from the slots.
Comment on attachment 54042 [details] [diff] [review] move mLazyState to nsXULElement::Slots r=shaver. How many bits are used in mLazyState, anyway?
Attachment #54042 - Flags: review+
Three. But I'd like to review their usage, too. A lot of that stuff was cooked up on too much caffeine and may be unnecessary.
sr=hyatt
Okay, I've checked in attachment 54042 [details] [diff] [review]. I'll leave this open as a reminder to merge bits once stuff has been cleaned up a bit more.
Summary: move nsXULElement::mLazyState to slots → merge mLazyState bits to save a word in slots
Target Milestone: mozilla0.9.6 → mozilla0.9.7
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Target Milestone: mozilla0.9.8 → mozilla0.9.9
To save another word in the mSlots, this patch collapses mLazyState and mAttributes: mLazyState takes the low three bits, mAttributes takes the high bits.
Keywords: review
Comment on attachment 66021 [details] [diff] [review] collapse mAttributes and mLazyState I tried really hard to find something to complain about here, and came up empty. I guess that means r=shaver.
Attachment #66021 - Flags: review+
Comment on attachment 66021 [details] [diff] [review] collapse mAttributes and mLazyState sr=hyatt
Attachment #66021 - Flags: superreview+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
To be 64-bit safe, you want +#define LAZYSTATE_MASK (((JSWord)1 << LAZYSTATE_BITS) - 1) +#define ATTRIBUTES_MASK (~LAZYSTATE_MASK) (note the (JSWord)1 rather than 1 in the first line). /be
Just made that change. Thanks.
Blocks: 124335
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: