Closed
Bug 110591
Opened 23 years ago
Closed 23 years ago
DOMClassInfo interface shortcuts twice as fast as Components.interface.*
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
WONTFIX
People
(Reporter: fabian, Assigned: jst)
Details
(Keywords: perf)
Attachments
(1 file, 1 obsolete file)
939 bytes,
text/html
|
Details |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012 BuildID: 2001102311 Here's an interesting one: function isAnchor(node) { var list = new Array(); for (var i = 0; i < 100000; i++) { list[i] = node instanceof HTMLAnchorElement; } } runs twice (7seconds vs 14 seconds in my test) as fast as function isAnchor(node) { for (var i = 0; i < 100000; i++) { list[i] = node instanceof Components.interfaces.nsIDOMHTMLAnchorElement; } } Any idea why? (I sure hope it's not because of XPCOM ;-) Testcase coming up. Reproducible: Always Steps to Reproduce: 1. Run the attached testcase 2. 3. Actual Results: HTMLAnchorElement comparison is twice as fast as Components.interfaces.nsIDOMHTMLAnchorElement comparison Expected Results: Same speed. Athlon 1Ghz 256MB RAM on linux Mandrake8.1. Tested on 0.9.5.
Reporter | ||
Comment 1•23 years ago
|
||
50000 runs. First button uses HTMLInputElement, second button uses Components.interfaces.nsIDOMHTMLInputElement
Reporter | ||
Comment 2•23 years ago
|
||
It's not just twice as fast... on my computer it's about 30 times as fast (???). Is it because HTMLInputElement is cached as a property of the global object while Components.interfaces.* is resolved everytime we access it?
Attachment #58214 -
Attachment is obsolete: true
Comment 3•23 years ago
|
||
today's tip gives me 1970 vs 2418 on the 10k test, 9752 vs 12709 on 50k. A few days back build gives 10391 vs 13346 on the 50k test, and 2069 vs 2634 on 10k. That's a ratio of 0.79 and 0.78 a few days back, 0.81 and 0.77 today, (10, 50k)
Reporter | ||
Comment 4•23 years ago
|
||
OK I re-tested with both Mozilla 0.9.5 and a nightly build on win2k Athlon 1Ghz 256MB RAM. It seems we have a huge regression on our hands here. 0.9.5: ****************** Shortcut 10k: 15ms | Components.* 10k: 300ms Shortcut 50k: 75ms | Components.* 50k: 1500ms | Nightly: | ****************** | Shortcut 10k: 235ms | Components.* 10k: 300ms Shortcut 50k: 1190ms | Components.* 50k: 1600ms So the Components.* times are steady, but the DOMClassInfo shortcut times were severely regressed! I seem to remember a checkin to remove the security manager optimization. Might it be the cause?
Assignee | ||
Comment 5•23 years ago
|
||
The code: for (var i = 0; i < 100000; i++) { list[i] = node instanceof Components.interfaces.nsIDOMHTMLAnchorElement; } is bound to be slower than: for (var i = 0; i < 100000; i++) { list[i] = node instanceof HTMLAnchorElement; } since there's more work that needs to be done when running the former compared to when running the latter (more '.'s in the code, more expensive implementations, ...). The regression is due to the lack of the security check optimization we used to have in the DOM code, it was taken out because it exposed exploitable security holes. New optimization on it's way, once that's checked in I'm leaning towards marking this WONTFIX.
Reporter | ||
Comment 6•23 years ago
|
||
What you're saying is scary :-) I'm fine with marking this WONTFIX. I wonder what the chrome perf would be if we optimized every single of js to have as few characters as possible ;-)
Reporter | ||
Comment 7•23 years ago
|
||
In 0.9.7 the DOM shortcut is once again much faster than the full Components.* path (30 times faster, is that possible??). Since it seems to be due to nothing particular (see comment 5), i'm marking this WONTFIX.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Updated•11 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•11 years ago
|
blocking-b2g: tef? → ---
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•