Perftest function creation 2

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
object anonymous function expression name shorthand
var i = 0,
    obj = {
         funcWhatever: function funcWhateverFunction(object) {


              'use strict';
              return JSON.stringify(object, null, 4);
         }
    },
    funcWhat;

funcWhat = obj.funcWhatever;
for (; i < 100000; ++i) {
    funcWhat({});
};
ready
object named function expression shorthand
var i = 0,
    obj = {},
    funcWhatever = function funcWhateverFunction(object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    },
    funcWhat;
obj.funcWhatever = funcWhatever;
funcWhat = obj.funcWhatever;

for (; i < 100000; ++i) {
    funcWhat({});
};
ready
named function expression
var i = 0,
    funcWhatever = function funcWhateverFunction(object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    };

for (; i < 100000; ++i) {
    funcWhatever({});
};
ready
named function expression by name
var i = 0,
    funcWhatever = function funcWhateverFunction(object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    };

for (; i < 100000; ++i) {
    funcWhateverFunction({});
};
ready
object anonymous function expression
var i = 0,
    obj = {
         funcWhatever: function (object) {


              'use strict';
              return JSON.stringify(object, null, 4);
         }
    }

for (; i < 100000; ++i) {
    obj.funcWhatever({});
};
ready
anonymous decl
var i = 0;
for (; i < 100000; ++i) {
    (function (object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    })({});
};
ready
anonymous function expression
var i = 0,
    funcWhatever = function (object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    }

for (; i < 100000; ++i) {
    funcWhatever({});
};
ready
named function declaration
var i = 0;
    function funcWhatever(object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    };

for (; i < 100000; ++i) {
    funcWhatever({});
};
ready
object anonymous function expression name
var i = 0,
    obj = {
         funcWhatever: function funcWhateverFunction(object) {


              'use strict';
              return JSON.stringify(object, null, 4);
         }
    }

for (; i < 100000; ++i) {
    obj.funcWhatever({});
};
ready
object named function expression
var i = 0,
    obj = {},
    funcWhatever = function funcWhateverFunction(object) {


         'use strict';
         return JSON.stringify(object, null, 4);
    };
obj.funcWhatever = funcWhatever;
for (; i < 100000; ++i) {
    obj.funcWhatever({});
};
ready

Revisions

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