array of funcs iteration (v2)

Revision 2 of this benchmark created on


Setup

const len = 10;

const arr = [...Array(len).keys()];

const arr1 = arr.map(i => () => {});

const arr2 = arr.slice(0, -1).map(i => () => {});
arr2.push(() => {});

const arr3 = [];
for (let i = 0; i< arr.length; i++) {
  arr3[i] = () => {};
}

const iterate = (arr) => {
  for (let i = 0; i < arr.length; i++) {
    r = arr[i];
  }
}

Test runner

Ready to run.

Testing in
TestOps/sec
map
iterate(arr1);
ready
map + push
iterate(arr2);
ready
for
iterate(arr3);
ready

Revisions

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