pre-allocated arrays (v33)

Revision 33 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
empty array
var arr = new Array();
for (var i = 0; i < 10000; i++) {
  arr[i] = i;
}
ready
pre-allocated array
var arr = new Array(10000);
for (var i = 0; i < 10000; i++) {
  arr[i] = i;
}
ready
empty literal /w push
var arr = [];
for (var i = 0; i < 10000; i++) {
  arr.push(i);
}
ready
empty literal
var arr = [];
for (var i = 0; i < 10000; i++) {
  arr[i] = i;
}
ready
test
var arr = new Array(10000);
for (var i = 0; i < 10000; i++) {
   arr.push(i);
}
ready

Revisions

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