var foo = new Array();var bar = [];
Not to mention that literals are always faster than object constructors. Observe (blame Blogger's lack of proper tag allowance for the ugly code): .ie measure(null, [], 10000, function() { var x = new Array(); x[1] = 0; }, function() { var x = []; x[1] = 0; }); IE7: func 1: [T:701ms], func 2: [T:421ms] .ff measure(null, [], 10000, function() { var x = new Array(); x[1] = 0; }, function() { var x = []; x[1] = 0; }); FF2: func 1: [T:1011ms], func 2: [T:731ms]
1 comments:
Not to mention that literals are always faster than object constructors.
Observe (blame Blogger's lack of proper tag allowance for the ugly code):
.ie measure(null, [], 10000, function() { var x = new Array(); x[1] = 0; }, function() { var x = []; x[1] = 0; });
IE7: func 1: [T:701ms], func 2: [T:421ms]
.ff measure(null, [], 10000, function() { var x = new Array(); x[1] = 0; }, function() { var x = []; x[1] = 0; });
FF2: func 1: [T:1011ms], func 2: [T:731ms]