Karl Swedberg schrieb:
> Ok, so I put together a little test page at 
> http://test.learningjquery.com/speed-test.htm
>
> I run the following queries, using .click() and checking the 
> difference between the time they start and the time they end (on FF2 Mac):
> $(.dialog)
> $(div.dialog)
> $(div).filter('.dialog')
>
> There are 49 DIVs with class="dialog" on the page.
>
> $(.dialog) averages ~30 milliseconds
> $(div.dialog) and $(div).filter('.dialog') usually clock in around 
> 19-20 milliseconds
>
> The first one to be clicked typically takes about 10ms longer than 
> subsequent clicks on it.
>
> Here is the really weird part: 
> On every 7th click, the query will take 70 - 85 milliseconds, no 
> matter which one is clicked or what the order is.
>
> I figure there must be something really stupid about the way I'm doing 
> this.  All the code is in the <head>, so feel free to take a look, and 
> if it's really dumb, post to the list and let everyone know to 
> disregard these numbers. If it's not so dumb and someone wants to test 
> it on another system/browser, I'd be interested to hear what your 
> results are.
I can confirm those numbers. The seventh click is really weird. It 
doesn't even matter in which sequence you run those queries, be it "1 2 
3 1 2 3 1", it's always the seventh click that takes longer.

Could you add some tests with IDs? Eg. #id, div#id, div#id.class.

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to