W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: Node append

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 20 Sep 2011 15:57:41 -0700
Message-Id: <536E81AA-DF17-4F68-8F3F-4AFBB60C7CBA@jumis.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, Robin Berjon <robin@berjon.com>, "www-dom@w3.org" <www-dom@w3.org>
To: Ojan Vafai <ojan@chromium.org>




On Sep 20, 2011, at 3:39 PM, Ojan Vafai <ojan@chromium.org> wrote:

> On Tue, Sep 20, 2011 at 1:55 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 9/20/11 4:48 PM, Robin Berjon wrote:
> I can probably live with overloading things like appendChild to take arrays as long as we keep in mind that this will slow down every single appendChild call in the common case of a node being passed.  Presumably we're ok with this, since we're discussing it.
> 
> I would assume that it depends on how much of a hit we're talking about.
> 
> It really depends on what other work is involved in the appendChild call, obviously.
> 
> In the case of Gecko today, I would expect about a 30-40% hit or so, without having actually measured carefully.  We're working on reducing that, but also working on speeding up the common case, of course.  Where the final hit of an overloaded method compared to a non-overloaded one will converge is still an open question and likely to depend on particular hardware architectures, implementation strategies, etc... (e.g. if you make both slow enough you could obviously have no appreciable hit for the overloaded case).
> 
> I'd like to see all these methods take any of the following: node, string, array, nodelist. 
> 
> The added benefit of these APIs is worth some performance hit. Also, as people start using these APIs effectively, many things will be more efficient, e.g. appending an array should be faster than appending each node inside the array with individual appendChild calls, right?


Aren't these sped up in repeat calls on the JIT compiler? Seems mostly an issue about type boxing.
Received on Tuesday, 20 September 2011 22:58:13 GMT

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