W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: modifying the DOM WAS: Node append

From: Sean Hogan <shogun70@westnet.com.au>
Date: Fri, 07 Oct 2011 07:30:24 +1100
Message-ID: <4E8E0FE0.1060803@westnet.com.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Ojan Vafai <ojan@chromium.org>, Anne van Kesteren <annevk@opera.com>, Aryeh Gregor <ayg@aryeh.name>, Erik Arvidsson <arv@chromium.org>, Olli@pettay.fi, Robin Berjon <robin@berjon.com>, www-dom@w3.org, Alex Russell <slightlyoff@chromium.org>
On 7/10/11 12:43 AM, Boris Zbarsky wrote:
> On 10/6/11 8:39 AM, Sean Hogan wrote:
>>> The point being that the performance tradeoff is actually not obvious
>>> here.
>>
>> Thanks. My reading of that is that for an array of nodes the performance
>> can't possibly be better than calling (say) appendChild() separately for
>> each node, due to all the JS <-> C++ transitions. Is that correct?
>
> No.  A correct statement is that the performance may be better or 
> worse or about the same, depending on the performance of the DOM 
> bindings involved, the level of coupling between the DOM 
> implementation and the JS engine (e.g. can the DOM implementation get 
> its hands directly on the underlying storage of a JS array?), the 
> speed of the native-code APIs for extracting elements from an array, 
> etc, etc.
>

OK. I'm guessing that a similar statement would be made for the 
comparison of (say) setAttrValues and setAttribute. Meaning it shouldn't 
be argued for purely on performance grounds.

Sean
Received on Thursday, 6 October 2011 20:30:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT