performance testing of named or anonymous functions (v43)

Revision 43 of this benchmark created by John 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) {
  var myEventHandler = function(base) {
    return Math.pow(base, 10);
  };

  var x = myEventHandler(i);
}
ready
function expression
var myEventHandler = function(base) {
  return Math.pow(base, 10);
};

for (var i = 0; i < 10000; ++i) {
  var x = myEventHandler(i);
}
ready
function declaration
function myEventHandler2(base) {
  return Math.pow(base, 10);
}

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

Revisions

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