W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Re: Allow to return same NodeList object for queries like getElementsByTagName, getElementsByClassName and getElementsByName

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 12 Feb 2010 16:09:58 +0100
To: "Maciej Stachowiak" <mjs@apple.com>
Cc: "Anton Muhin" <antonm@chromium.org>, public-webapps@w3.org
Message-ID: <op.u70sewz864w2qv@annevk-t60>
On Fri, 12 Feb 2010 14:13:57 +0100, Maciej Stachowiak <mjs@apple.com>  
> On Feb 12, 2010, at 5:05 AM, Anne van Kesteren wrote:
>> Is it really a lot of performance? Our developers are not that  
>> convinced.
> A patch that made the change in WebKit was measured as a 20% speedup on  
> the Dromaeo DOM Core tests in both Safari and Chrome. Calling these  
> query methods is only a small fraction of the test, so this implies a  
> much larger speedup to the case where getElementsBy* is called in a  
> loop. Note also that this involved two different JavaScript engines so  
> it's unlikely to be a quirk specific to one engine. The Gecko bug cited  
> above also shows dramatic speedups on various tests.

It would be interesting to know what exactly that test is. Optimizing for  
benchmarks is not always useful :-)

Also, what happens with garbage collection? Say some isolated piece of  
code does:

   x = document.getElementsByTagName("x")
   x.p = 2

... and then later on some other piece of code does:

   y = document.getElementsByTagName("x")
   w("p" in y)

Depending on whether or not x got garbage collected you would get a  
different result.

Anne van Kesteren
Received on Friday, 12 February 2010 15:10:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:05 UTC