Closed Bug 754480 Opened 13 years ago Closed 13 years ago

MemShrink nsIPresShell/PresShell more

Categories

(Core :: Layout, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

Details

(Whiteboard: [MemShrink:P3])

Attachments

(5 files)

No description provided.
Attachment #623349 - Flags: review?(bzbarsky)
Sort nsIPresShell/PresShell members in size order. Make all bool fields "bool : 1" Narrow a few other types as well: ScrollAxis::WhenToScroll 32-bit => 16-bit mRenderFlags 32-bit => 8-bit mChangeNestCount 32-bit => 16-bit (this counts mutual recursive invocations from the frame constructor, and there's usually 4-5 stack frames per increment so I think we would crash before exhausting 16 bits anyway) Move all the member fields to the end of the class for code readability.
Attachment #623350 - Flags: review?(bzbarsky)
Remove these PresShell members: ScrollAxis mContentScrollVAxis; ScrollAxis mContentScrollHAxis; PRUint32 mContentToScrollToFlags; this is data associated with mContentToScrollTo for a delayed ScrollContentIntoView. Put the data in a content property on mContentToScrollTo instead, and remove it after the scroll happens.
Attachment #623352 - Flags: review?(bzbarsky)
Remove the PresShell::mPrefStyleSheet member, look it up in mStyleSet when needed instead (the StyleSet owns it).
Attachment #623355 - Flags: review?(bzbarsky)
With the above changes the size of a PresShell instance goes from: sizeof=456 moz_malloc_size_of=456 to sizeof=376 moz_malloc_size_of=384 https://tbpl.mozilla.org/?usebuildbot=1&tree=Try&rev=b5bb7ff4e629
Comment on attachment 623349 [details] [diff] [review] part 1, remove unused mDragService member r=me
Attachment #623349 - Flags: review?(bzbarsky) → review+
Comment on attachment 623350 [details] [diff] [review] part 2, sort members in size order. Use narrower types where possible. r=me
Attachment #623350 - Flags: review?(bzbarsky) → review+
Comment on attachment 623352 [details] [diff] [review] part 3, remove PresShell members associated with mContentToScrollTo r=me
Attachment #623352 - Flags: review?(bzbarsky) → review+
Comment on attachment 623355 [details] [diff] [review] part 4, remove PresShell::mPrefStyleSheet It's not obvious to me that saving this one word is worth having to grovel through the style set and depending on no extension using a URI like that for the sheet. If we _do_ want to do this, I'd like to see a -w diff, though.
Attached patch part 4, as wdiffSplinter Review
I'd still like to see some actual numbers indicating that the one-word savings is worth the runtime perf hit....
Yeah, I wouldn't add any complexity to save a word or two in PresShell.
Whiteboard: [MemShrink] → [MemShrink:P3]
Comment on attachment 623355 [details] [diff] [review] part 4, remove PresShell::mPrefStyleSheet I don't feel strongly about this one word, so let's skip this patch for now... (In reply to Boris Zbarsky (:bz) from comment #9) > depending on no extension using a URI like that > for the sheet. GetUserPrefSheet would return the first sheet with that URI - I don't think extensions can add sheets before it (AddSheet does AppendElement). (We could make sure this sheet is always the first if necessary.) (In reply to Boris Zbarsky (:bz) from comment #11) > I'd still like to see some actual numbers indicating that the one-word > savings is worth the runtime perf hit.... In a default profile, SheetCount(nsStyleSet::eUserSheet) is 1, so GetUserPrefSheet would do a single URI string check per call. The methods involved are called when creating/deleting a new pres shell making 5 or so calls. So the perf hit is negligible. (In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #12) > Yeah, I wouldn't add any complexity to save a word or two in PresShell. I think the patch reduces complexity. The StyleSet owns all the sheets, so I regard the mPrefStyleSheet alias as added complexity. I think these pref sheet methods does not belong in pres shell and should move somewhere else in the long term, at least to a separate file.
Attachment #623355 - Flags: review?(bzbarsky)
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: