Closed Bug 114539 Opened 24 years ago Closed 24 years ago

Die mInner, die! :-)

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.8

People

(Reporter: jst, Assigned: jst)

Details

(Whiteboard: [HAVE FIX])

Attachments

(1 file)

Character data nodes (text, comment, pi, ...) in mozilla currently have an inner object that does most of the work. Inheriting the code makes much more sense since that lets us save memory and lets us get rid of lots of forwarding functions in the classes that use the inner object. Patch coming up that gets rid of mInner, and reduces the size of nsTextNode from 44 bytes to 28 bytes (by pushing some rarely used members out into hash tables), yay!
The attached patch changes a number of things, most importantly: - Makes nsGenericDOMDataNode a class that implements nsITextContent, and all classes that used to have a mInner of type nsGenericDOMDataNode now inherits from nsGenericDOMDataNode. - Removes mContentID from nsTextNode, since I can't think of any code that could ever need a content ID for a *text* node. - Pushes the mEventListnereManager and mRangeLists members out of nsGenericDOMDataNode into two separate hash tables (these two hashes could actually be combined if we need to for some reason) and uses the low bits of what used to be mParent to know if there's anything in either of those hashes for a particular node. - Reduces some extra string copying in nsGenericDOMDataNode when converting ASCII data to UCS2. The net result of these changes is that the size of a nsTextNode (i.e. every text node in a DOM tree) is reduced from 44 bytes to 28 bytes, not including string data. The new code should be both faster and smaller, but data and runtime footprint.
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.8
Comment on attachment 61417 [details] [diff] [review] Remove mInner from data nodes, and reduce the size of nsTextNode from 44 bytes to 28, yay :-) >+ NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA() Drop the parens. >- rv = DeleteData(aOuterContent, aOffset, length-aOffset); >+ rv = DeleteData(aOffset, length-aOffset); Add spaces around the minus. More tomorrow.
sr=hyatt
Comment on attachment 61417 [details] [diff] [review] Remove mInner from data nodes, and reduce the size of nsTextNode from 44 bytes to 28, yay :-) yay! r=peterv.
Attachment #61417 - Flags: review+
Comment on attachment 61417 [details] [diff] [review] Remove mInner from data nodes, and reduce the size of nsTextNode from 44 bytes to 28, yay :-) Copying hyatt's sr. Just one comment: is there any reason why you removed the ScriptGlobalObject fu in nsGenericDOMDataNode::SetDocument()?
Attachment #61417 - Flags: superreview+
Yeah, it did nothing, it is pointless code in the post-XPCDOM world (i.e. should've been removed a long time ago).
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
marking verfied
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: