0-fill n-size Array (v16)

Revision 16 of this benchmark created on


Setup

window.growFactor = 1000;

Test runner

Ready to run.

Testing in
TestOps/sec
for-loop Fill (1x)
var arr = [],
    l = window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (2x)
var arr = [],
    l = 2 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (3x)
var arr = [],
    l = 3 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (4x)
var arr = [],
    l = 4 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (5x)
var arr = [],
    l = 5 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (6x)
var arr = [],
    l = 6 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (7x)
var arr = [],
    l = 7 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (8x)
var arr = [],
    l = 8 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (9x)
var arr = [],
    l = 9 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fill (10x)
var arr = [],
    l = 10 * window.growFactor;
arr.length = l;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fille (5x; Not initialized)
var arr = [],
    l = 5 * window.growFactor;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
for-loop Fille (1x; Not initialized)
var arr = [],
    l = window.growFactor;
for (var i = 0; i < l; ++i) {
  arr.push(0);
}
ready
while (1x)
var arr = [];
var ln = window.growFactor;
var l = window.growFactor;

while (l--) {
 arr[ln - l] = 0;
}
ready

Revisions

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