Fun stats

Benchmark created by inabahare on


Setup

const arr = [];
  
  for (let i = 0; i < 10000; i++)
    arr.push(i);

Test runner

Ready to run.

Testing in
TestOps/sec
map
arr.map(val => val * 2);
ready
forEach
arr.forEach(val => val * 2);
ready
For
for (let i = 0; i < arr.length; i++)
  arr[i] *= 2;
ready
For in
for (const i in arr)
  arr[i] *= 2;
ready

Revisions

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

  • Revision 1: published by inabahare on