new array vs literal (v22)

Revision 22 of this benchmark created by Robert on


Setup

var count = 1000;
    
    var arrayLiteral = [];
    
    var arrayConstructor = new Array();

Test runner

Ready to run.

Testing in
TestOps/sec
Array Literal & push
for (var i = 0; i < count; i++) {
  arrayLiteral.push(i);
}
ready
new Array(count)
for (var i = 0; i < count; i++) {
  arrayConstructor.push(i);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.