performance testing of named or anonymous functions (v13)

Revision 13 of this benchmark created on


Description

a small comparision betwean named function and function declaration

Test runner

Ready to run.

Testing in
TestOps/sec
anonymous
for (var i = 0; i < 10000; ++i) {
  'use strict';
  var x = function(someParam) {
    var someVariable = someParam;
    return someVariable;
  }(true);
}
ready
function expression
myEventHandler = function(someParam) {
  'use strict';
  // do something
  var someVariable = someParam;
  return someVariable;
}

for (var i = 0; i < 10000; ++i) {
  var x = myEventHandler(true);
}
ready
function declaration
function myEventHandler2(someParam) {
  'use strict';
  // do something
  var someVariable = someParam;
  return someVariable;
}

for (var i = 0; i < 10000; ++i) {
  var x = myEventHandler2(true);
}
ready

Revisions

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