On Dec 19, 2006, at 1:09 AM, Aaron Heimlich wrote:
If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http:// aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like:

$(.dialog) does 815 function calls (!!!!)
$('#speech28') does 6 function calls


Wow, Aaron, that is very cool. Thanks!


On Dec 19, 2006, at 2:32 AM, Dragan Krstic wrote:
2006/12/19, Christof Donat <[EMAIL PROTECTED]>:
Hi,

> looking for an ID (which should be unique) after getting the tags is
> worthless.

Well, it shouldn't be. I might whant to hide an Element with the id "myid" only if it is an image. Then I'd try first $('img#myid').hide() and expect it
to work like $('#myid').filter('img').hide().

ID should be uniqe over the page, so  div#myid is redundant.

Dragan,
I think what Christof is getting at is this: on any given page, #myid could be uniquely assigned to a div or a paragraph or a span or an image or any other element. So, page 1 could have <div id="myid"></ div> and page 2 could have <p id="myid"></p>

If the same script is being included on multiple pages, it might be necessary to specify that an event take place only if #myid is attached to, for example, the div. In this scenario, div#myid is not redundant.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Dec 19, 2006, at 1:09 AM, Aaron Heimlich wrote:

If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http:// aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like:

$(.dialog) does 815 function calls (!!!!)
$('#speech28') does 6 function calls

On 12/18/06, Karl Swedberg <[EMAIL PROTECTED]> wrote:
Thank you for that summary, Jake! And for the stat lesson. :)


On Dec 18, 2006, at 11:19 PM, Ⓙⓐⓚⓔ wrote:

Since the 7th click is reproducible, and has little to do with the issue, you can discard the value, with a simple note... years of stat classes!

conclusions:
running thru the whole dom looking for a class is slow.
looking for an ID (which should be unique) after getting the tags is worthless. looking for a class after getting a subset of the dom is faster than searching the whole dom.
Safari is almost always faster than ff!
Just what was expected!

GREAT WORK!

On 12/18/06, Karl Swedberg < [EMAIL PROTECTED]> wrote:
Hey everyone,

I have results of a few more speed tests that I ran this evening at
http://test.learningjquery.com/speed-test.htm

Method: I clicked 10 times on each query in Firefox 2.0 and Safari 2.0.4 (See HTML source for all code, markup, etc.) I recorded the mode (most common value) and the range of values for each, all in milliseconds.

@ FF2 / Safari2

1. $('#speech28')
- mode: 1 / 1
- range: 0-1 / 0-4

2. $('div#speech28')
- mode: 43 / 32
- range: 42-59 / 30-35

3. $('#final-speech div.final-dialog ')
- mode: 5ms / 5ms
- range: 4-6 / 3-6

4. $('#final-speech .final-dialog')
- mode: 6 / 5
- range: 5-8 / 3-6

5. $('div.final-dialog')
- mode: 55 / 40
- range: 28-253  / 40-45

6. $('.final-dialog')
- mode: 101 / 51
- range: 83-306 / 51-68

***
Note that queries 5 and 6 have huge ranges in Firefox because of the mysterious seventh click issue.

Looks like these tests confirm what we've all been saying on this list about the relative speed of various selectors.

This has been a fascinating exercise. I'd love to hear people's analysis, etc.


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

Reply via email to