pre-allocated arrays (v66)

Revision 66 of this benchmark created on


Setup

var test = new Array(100000);
  for(var j=0; j<100000; j++) {test[j] = {'qwe':'asd'}}

Test runner

Ready to run.

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

Revisions

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