performance testing of named or anonymous functions (v24)

Revision 24 of this benchmark created by zerkms 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 x = function() {};
  x();
}
ready
function expression
var myEventHandler = function() {
  // do something
}

for (var i = 0; i < 10000; ++i) {
  var x = myEventHandler();
}
ready
function declaration
function myEventHandler2() {
  // do something
}

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

Revisions

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