Function Declarations vs. Function Expressions (v2)

Revision 2 of this benchmark created by Jasper on


Setup

var expression = function(){
    return 1+1;
    };
    
    function declaration(){
    return 1+1;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Function Declaration
function X() { return "hello"; }
function Y() { return X(); }
function Z() { return Y(); }
Z();
ready
Function Expression
var X = function () { return "hello"; };
var Y = function () { return X(); };
var Z = function () { return Y(); };
Z();
ready
Function Expression 2
var X = function () { return "hello"; },
Y = function () { return X(); },
Z = function () { return Y(); };
Z();
ready
Predefined expression
expression();
ready
Predefined declaration
declaration();
ready

Revisions

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