js performance is more about coding than browsers.
while you may have found a subtle distinction in between browsers for two ways of doing one thing, there are other ways of doing that thing.
for example, this scores about 25X faster than method1 in my quick estimation:
Code:
function method3(){
start = new Date();
testString=Array(numIterations+1).join('aa bb');
end = new Date();
$('#testResult1').val(end-start);
return end-start;
}
25:1 pretty much makes the differences between method1 and method2 insignificant.
What's interesting to me is watching how browsers adapt to code over time. The chrome team has jQuery in their dev-cycle nightly perf test batches. What that means is that chrome is developed to run jquery et al faster.
while twiddling knobs in an attempt to get faster real-world code, sometimes browser makers obsolete old best practices.
for example. IE and older firefox is several times faster at populating arrays using array[array.length]=value than array.push(value).
but the chome saw that more code actually uses push().
as a result, here's how chrome scores those two methods:
Code:
MS TEST
60 array build - [].length trick
32 array build - push()
given how much faster chrome is than ie, i still use [].length, but it's an illustrative example of how everything from duff's devices, early declaration, array length caching and other common performance tweaks don't always result in millisecond payday anymore...