[thelist] Opera, JavaScript and the DOM

Liorean Liorean at user.bip.net
Sat Nov 23 09:59:01 CST 2002


After doing some tests through my optimisation page, I've found out that
Opera has a severe problem when it comes to letting the DOM work on a page.

The thing is, that the more content there is on the page, the longer each
DOM operation takes. This includes totally unrelated DOM operations, such
as text added to a page through
tablecell.appendChild(document.createTextNode('blah')) slowing down
document.images.

The action is this: b=document.images[a]; (DOM0 & DOM1, does that make some
difference? I'll have to do more testing.)
The action is run 100 000 times.

Before adding any text to the dom:
 > 26999ms

After adding about 4 000 bytes in a total of 36 text nodes:
 > 44574ms

(This difference also appear if you compare a document and that same
document with an additional 4kb content written into it. So it's not using
the dom to add text that is the problem.)


In relation, here's the moz1.2a and ie6win times before and after:
Before:
moz> 2985ms
iew> 2013ms

After:
moz> 2994ms
iew> 2013ms

Note: ie has a variation of about 100ms up and down, moz about 150ms and
opera about 800ms between prime runs.


Just for fun the same 100 000 actions in nn4.79 takes just 971ms (variation
here is just about 30ms). As that browser doesn't have DOM support, though,
it's irrelevant in this case.



In short, on a larger document opera might get slow.

// Liorean




More information about the thelist mailing list