Array direct assignment vs push (big array) (v49)

Revision 49 of this benchmark created on


Setup

var directArray = [];
    var pushArray = [];
    var presizedArray = Array(100000);

Test runner

Ready to run.

Testing in
TestOps/sec
Direct assignment
for(var i = 0; i < 100000; i++)
{
  directArray[i] = "test";
}
ready
Push
for(var i = 0; i < 100000; i++)
{
  pushArray.push("test");
}
ready
Direct assignment with pre-allocate
var pp=-1;
for(var i = 0; i < 100000; i++)
{
  directArray[pp++] = "test";
}
ready

Revisions

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