Push vs length (v26)

Revision 26 of this benchmark created by Tomas Corral on


Setup

var myArray = [];
  var myArray2 = [];
  var myArray3 = new Array(100000);

Test runner

Ready to run.

Testing in
TestOps/sec
length
for (i = 0; i <= 100000; i++) {
  myArray[myArray.length] = i;
}
ready
push
for (i = 0; i <= 100000; i++) {
  myArray2.push(i);
}
ready
third
for (i = 0; i <= 100000; i++) {
  myArray3[myArray3.length] = i;
}
ready

Revisions

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