For anyone interested, here is the updated set of 'tests' for the test page I posted previously. This is the test-set John is currently using:
// Test # 1 start = new Date(); $Test = $("#div"+ myDiv +" p"); end = new Date(); a_Selectors.push('$("#div'+ myDiv +' p")'); a_Times.push(end - start); // Test # 2 start = new Date(); $Test = $("p", "#div"+ myDiv); end = new Date(); a_Selectors.push('$("p", "#div'+ myDiv +'")'); a_Times.push(end - start); // Test # 3 start = new Date(); $Test = $("#div"+ myDiv).find("p"); end = new Date(); a_Selectors.push('$("#div'+ myDiv +'").find("p")'); a_Times.push(end - start); // Test # 4 start = new Date(); $Test = $("#div"+ myDiv +" > p"); end = new Date(); a_Selectors.push('$("#div'+ myDiv +' > p")'); a_Times.push(end - start); // Test # 5 start = new Date(); $Test = $("#div"+ myDiv).children("p"); end = new Date(); a_Selectors.push('$("#div'+ myDiv +'").children("p")'); a_Times.push(end - start); // Test # 6 start = new Date(); $Test = $($("#div"+ myDiv)[0].childNodes).filter("p"); end = new Date(); a_Selectors.push('$( $("#div'+ myDiv +'")[0].childNodes ).filter ("p")'); a_Times.push(end - start); If you created your own test page, just copy-n-paste these tests into it. NOTE that setting: 'c_divs=1000' and 'c_paras=500' (as John is using) makes the page very slow to load because it has to generate all these elements. So for quick tests, reduce these numbers to 100 each. But if you find something interesting, try cranking the numbers up again - it magnifies the speed differences between the tests. /Kevin On Feb 25, 6:48 pm, RobG <rg...@iinet.net.au> wrote: > On Feb 26, 11:22 am, John Resig <jere...@gmail.com> wrote: > > The benchmark is getElementById().getElementsByTagName() - why not > inlcude that in the test? Add the following below test 3: > > // Test # 4 > start = new Date(); > $Test = document.getElementById('div' + > myDiv).getElementsByTagName('p'); > end = new Date(); > a_Selectors.push('getEBI().getEBTName()'); > a_Times.push(end - start); > > -- > Rob