Closed Bug 584287 Opened 14 years ago Closed 14 years ago

Make getting id/class/etc faster

Categories

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

x86
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla2.0b4
Tracking Status
blocking2.0 --- beta4+

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

A bit of thisType magic on nsIDOMHTMLElement goes a long way. The element.property subtest of dromaeo's dom-attr test (which just tests getting .id on an HTML element) gets about 30% faster with this patch.
Blocks: domperf
Attached patch Like soSplinter Review
Attachment #462686 - Flags: review?(peterv)
Attachment #462686 - Flags: approval2.0?
Priority: -- → P1
Summary: Make getting id/class/etc faster → [FIX]Make getting id/class/etc faster
Comment on attachment 462686 [details] [diff] [review] Like so This works because all of the HTML elements just forward these getters/setters to nsGenericHTMLElement. Unfortunately I don't think there's an easy way to enforce that.
Attachment #462686 - Flags: review?(peterv) → review+
Well, the only reason they need to forward is that nsGenericHTMLElement itself isn't what implements nsIDOMHTMLElement. That seems like a bug in itself... ;)
Summary: [FIX]Make getting id/class/etc faster → Make getting id/class/etc faster
Whiteboard: [need approval]
Attachment #462686 - Flags: approval2.0? → approval2.0+
blocking2.0: --- → beta4+
Whiteboard: [need approval] → [need landing]
Pushed http://hg.mozilla.org/mozilla-central/rev/6e97f59bcb1c which broke because apparently on Windows quickstubs includes windows.h, which redefines GetClassName to GetClassNameA. And since we were now calling a non-virtual method, linking failed. khuey pushed http://hg.mozilla.org/mozilla-central/rev/373d1b393f28 to fix that.
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b4
Whiteboard: [need landing]
Some combination of this and bug 584293 gave us a 5% win on Dromaeo (DOM) on tinderbox on Linux and Mac.
(In reply to comment #3) > Well, the only reason they need to forward is that nsGenericHTMLElement itself > isn't what implements nsIDOMHTMLElement. That's because most HTML elements implement interfaces that inherit from nsIDOMHTMLElement, so implementing nsIDOMHTMLElement in nsGenericHTMLElement wouldn't help much.
I think we should think long and hard about whether it makes sense for our C++ class inheritance hierarchy (including for the interface classes) to match the interface inheritance hierarchy defined in the idl... But that's totally out of scope for this bug.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: