W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2013

Re: [whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragments

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 25 Jul 2013 09:02:50 -0700
Message-ID: <51F14C2A.5050809@mit.edu>
To: whatwg@lists.whatwg.org
On 7/24/13 5:39 PM, Ryosuke Niwa wrote:
> Indeed.  Note that querySelector implementations in WebKit and Blink optimize #foo, .foo, etc... so that they're equally if not faster than getElementsById, getElementsByClassName, etc...

I have a hard time reconciling that claim with either code-inspection of 
WebKit code, general considerations of what it takes to implement these 
methods, or the numbers I see in Chrome on 

Now I realize that for querySelectorAll vs getElementsByClassName that 
microbenchmark largely shows the "reuse same list vs have to create a 
new list" difference, but real-life code would show such a difference 
too, in many cases.

Received on Thursday, 25 July 2013 16:03:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:03 UTC