- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 24 Sep 2009 09:06:55 -0400
- To: Sean Hogan <shogun70@westnet.com.au>
- CC: public-webapps <public-webapps@w3.org>
On 9/24/09 6:29 AM, Sean Hogan wrote: > I would be surprised if an implementation didn't create an internal > lookup table keyed off the selector text. Gecko doesn't. Webkit doesn't. I just checked really quickly, and on my machine (a year-plus old laptop) parsing the ".foo .bar .baz" selector and destroying the selector object before returning in Gecko takes about 80% of the "overhead" (that is, not walking the tree and doing selector matching) time of a querySelector() call. Or, in numbers, about 5.5us per call. Webkit's time for executing my testcase is comparable, though I can't tell how much of their time is selector parsing. If you're doing less than 1,000 calls that involve selectors api per second, the selector-parsing time is probably not that relevant. But I don't know what the use cases are here. -Boris
Received on Thursday, 24 September 2009 13:07:41 UTC