named or anonymous functions (v4)

Revision 4 of this benchmark created by Roshan on


Setup

var fnExp = function(someParam) {
      'use strict';
    
      var someVariable = someParam;
      return someVariable;
    };
    
    function someFunction(someParam) {
      'use strict';
    
      var someVariable = someParam;
      return someVariable;
    };
    
    var fnExpNamed = function _someFunction(someParam) {
      'use strict';
    
      var someVariable = someParam;
      return someVariable;
    };
    
    var dummyObj = {};
    dummyObj.someFunction = function _someFunction(someParam) {
      'use strict';
    
      var someVariable = someParam;
      return someVariable;
    };
    
    var copiedFn = dummyObj.someFunction;

Test runner

Ready to run.

Testing in
TestOps/sec
function expression

fnExp(true);
ready
function declaration

someFunction(true);
ready
named function expression

fnExpNamed(true);
ready
named function expression with object

dummyObj.someFunction(true);
ready
copied Fn
copiedFn(true);
ready

Revisions

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