Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Aaron Heimlich
On 12/19/06, joehewitt <[EMAIL PROTECTED]> wrote: Oh man, that is totally awesome. Just the kind of thing I was hoping people would do with Firebug. The jQuery community rocks! :) - Joe Thanks Joe! I know you've probably been hearing this alot lately, but Firebug (particulary 1.0 beta) rea

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Rey Bango
Thanks for stopping by Joe. Firebug rocks man and we're VERY appreciative of your efforts. Thanks for making this amazing tool for us developers. Rey joehewitt wrote: > Oh man, that is totally awesome. Just the kind of thing I was hoping people > would do with Firebug. The jQuery community ro

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread joehewitt
Oh man, that is totally awesome. Just the kind of thing I was hoping people would do with Firebug. The jQuery community rocks! :) - Joe 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

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Jörn Zaefferer
Stephen Woodbridge schrieb: > OK, here is an interesting tidbit. > > I used the test below and and did the 7 click thing, and out of all my > tests except one, the long delay happened in has() and once I got it in > find(). has() is pretty simple and I wonder if this has less to do with > the nu

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Karl Swedberg
btw, I just added a text input so you can run whatever query you want on the page. just type in the selector -- without $() -- and press the Test! button. In case anyone wants to try but has lost the thread, here is the URL again: http://test.learningjquery.com/speed-test.htm On Dec 19, 2

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Dragan Krstic
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 and page 2 could have If the same script is being included on multiple pages, it might be necessar

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Franck Marcia
Hi all, With the tests I ran (http://fmarcia.info/jquery/speedtest.html [1]), the quickest way to retrieve one element is $(document.getElementById(id)), even better than $('#id')! Off course, to get even better performance, one should cache queries every time it's possible! My 2 cents, Franck.

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Stephen Woodbridge
OK, here is an interesting tidbit. I used the test below and and did the 7 click thing, and out of all my tests except one, the long delay happened in has() and once I got it in find(). has() is pretty simple and I wonder if this has less to do with the number of clicks versus the number of reg

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Christof Donat
Hi, > If you want to keep performance, maybe it's better to do: > > if( $("#myid").is('div.myclass')) alert("YEAH, WE GOT IT"); > else alert("Ha, my ID is misused!!"); Yes, of course. If I whant to use jQuery methods I could also use filter(): $('#myid').filter('div.myclass').addClass('hereWeGo'

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Christof Donat
Hi, > I think what Christof is getting at is this: [...] Yes, exactly. Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Karl Swedberg
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

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Christof Donat
Hi, > > > ID should be uniqe over the page, so div#myid is redundant. > > [...] > > I know that. My point is that there should not be two elements with same id > on the page. At least, I'm developing like that. But that doesn't make the expression div#myid redundant. Of course the id should be

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Dotan Dimet
If you want to keep performance, maybe it's better to do: if( $("#myid").is('div.myclass')) alert("YEAH, WE GOT IT"); else alert("Ha, my ID is misused!!"); Wow. When I started writing this reply, I thought of using tagName and className, but is() is so much more elegant. Christof Donat wrote:

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Dragan Krstic
2006/12/19, Christof Donat <[EMAIL PROTECTED]>: Hi, > ID should be uniqe over the page, so div#myid is redundant. No, it isn't. It should return an empty jQuery-Object in case the Element with the id "myid" is not a div. That is usefull when you produce your Content dynamically (e.g. with PHP

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Brian Miller
> looking for an ID (which should be unique) after getting the tags is > worthless. Should we re-write the case of # to use elem.getElementBYId(), and then remove the element if it's not the right tag? - Brian ___ jQuery mailing list discuss@jquery.co

Re: [jQuery] More DOM Query Speed Tests

2006-12-19 Thread Christof Donat
Hi, > ID should be uniqe over the page, so div#myid is redundant. No, it isn't. It should return an empty jQuery-Object in case the Element with the id "myid" is not a div. That is usefull when you produce your Content dynamically (e.g. with PHP). The same is true for .myclass#myid, or even d

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Dragan Krstic
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 wo

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Christof Donat
Hi, > $(.dialog) does 815 function calls () > $('#speech28') does 6 function calls That is not very surprizing. $('#speech28') only needs to call getElementById() and make a jQuery Object from it. $('.dialog') gets all elements, puts them into an array and filters that array for the classna

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Christof Donat
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(). Christo

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Aaron Heimlich
On 12/19/06, Aaron Heimlich <[EMAIL PROTECTED]> wrote: $(.dialog) does 815 function calls () Whoops! that should be: $('.dialog') does 851 function calls () -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Aaron Heimlich
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,

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Karl Swedberg
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

Re: [jQuery] More DOM Query Speed Tests

2006-12-18 Thread Ⓙⓐⓚⓔ
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. lo

[jQuery] More DOM Query Speed Tests

2006-12-18 Thread Karl Swedberg
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 th