pre-allocated arrays (v23)

Revision 23 of this benchmark created by satchmorun on


Test runner

Ready to run.

Testing in
TestOps/sec
empty literal
var arr = [];
var i;

for (i = 0; i < 10000; i++) {
    arr[i] = i;
}

arr=[];
for (i = 0; i < 10000; i++) {
    arr[i] = 2 * i;
}

arr=[];
for (i = 0; i < 10000; i++) {
    arr[i] = 2 * i;
}
ready
pre-allocated array
var arr = new Array(10000);
var i;
for (i = 0; i < 10000; i++) {
    arr[i] = i;
}

for (i = 0; i < 10000; i++) {
    arr[i] = 2 * i;
}

for (i = 0; i < 10000; i++) {
    arr[i] = 2 * i;
}
ready

Revisions

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