Re: modifying the DOM WAS: Node append

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 UTC