I am testing the speed of jQuery selection with a cached DOM object as
the 'context' for the selection.

// method I prefer to use
var area1 = document.getElementById('mypage');
$('.stuff', area1)
$('.morestuff', area1)

// method faster in firefox
$('#mypage').find('.stuff')
$('#mypage').find('.morestuff')

The test code and stats are at : 
http://jsperf.com/jquery-selector-with-context-as-object/4

Can someone using Internet Explorer 9 (beta) run this test ?
http://jsperf.com/jquery-selector-with-context-as-object/4 It would be
nice to see how the IE9 browser performs.

It seems that firefox is fastest on this test with 'Select
then .find()' and other browsers are fastest with 'Selector with
context as dom object' (the object is cached so not using
document.getElementById for the context). I do like this tool
jsperf.com ; would Yahoo's Profiler be of any benefit in this type of
testing?

I usually like to store a dom object on the page that I'm working
with; like a div element used as body container - #mypage. Then with
the rest of my script use that as the context when selecting. So, I am
curious if the method of $('#id').find('.stuff') would be quicker;
this test seems to show that they both are fast.

Best regards,

-Bill Heaton
@pixelhandler

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to