map named functions more realisitic (v3)

Revision 3 of this benchmark created on


Description

I wanted to check if named functions are better than anonymous functions. Plus other comparisons.

Setup

var data = Array.apply(null, Array(10)).map(function(_, i) {
      return i;
    });
    
    var data2 = Array.apply(null, Array(10))
    
    // For using in tests
    var f2 = function(val, i) {
      data2[i] = val + 1;
    };
    
    var f = function(val) {
      return val + 1;
    };

Test runner

Ready to run.

Testing in
TestOps/sec
Map anonymous
data.map(f);
ready
for simple
for (var i = 0, len = data.length; i < len; i++) {
 f2(data[i], i);
}
ready

Revisions

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