named or anonymous functions (v5)

Revision 5 of this benchmark created 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;
    
    var sameNameFn = function sameNameFn(someParam) {
      'use strict';
    
      var someVariable = someParam;
      return someVariable;
    };

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
same Name Function
sameNameFn(true);
ready

Revisions

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