function vs arrow function

Benchmark created by wow_wow on


Setup

var array = [];
  var i = 0;
  
  for (i = 0; i < 100; i++) {
      array.push(i);
  }

Test runner

Ready to run.

Testing in
TestOps/sec
function
var j = array.length;
var result = 0;

while (j--) {
    (function(item) {
        result += item;
    })(j);
}
ready
arrow function
var j = array.length;
var result = 0;

while (j--) {
    (item => {
        result += item;
    })(j);
}
ready

Revisions

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

  • Revision 1: published by wow_wow on