Closed Bug 300316 Opened 19 years ago Closed 13 years ago

Save space in DOM element objects by tweaking interface hierarchy

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: roc, Unassigned)

Details

(Keywords: helpwanted, memory-footprint)

Consider nsHTMLOptionElement. It inherits from five interfaces and hence every
object will get five vtable pointers. I think we could quite easily reduce this
to two:
-- make nsIDOMNSHTMLOptionElement inherit from nsIDOMHTMLOptionElement
-- make nsIOptionElement inherit from nsIDOMNSHTMLOptionElement
-- make nsIJSNativeInitializer a tearoff
Similar things can be done to other HTML elements.
I'm not sure if the nsIJSNativeInitializer is worth doing since we only have
that for <img> and <option>, neither of those elements should be something that
we have enough of on a page to make it worth saving 4 bytes. Especially images
have enough other junk attached to them that 4 bytes doesn't make a difference i
bet.

The other two sounds like a good idea though as long as the nsIDOMNS* interface
isn't frozen.
Some pages have lots of options (thousands).
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
Similar thing could be done for many nsIDOMNS*** interfaces.
(or merge nsIDOM and nsIDOMNS)

Generally elements are nowadays more lightweight than they used to.
Especially XUL elements, Bug 26429.
Most nsIDOMNS* interfaces have been removed already; does anything else need to be done here?
We could probably slim down several things further.

The question is is it worth the effort?  Our memshrink numbers show that the content tree is rarely more than a few percent of the total memory usage of the browser.
I do think we should reduce the number of interfaces we have, but not to save memory (now that we have data, it indicates it's not worth the effort), but rather for code sanity.

So marking this WONTFIX. Hopefully most of this will happen as needed when we do the new DOM bindings anyway.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.