performance testing of named or anonymous functions (v27)

Revision 27 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
var Person = (function(){
        var _age = 5;

        function Person(){
        }

        Person.prototype.getAge = function(){
                return _age;
        }

        return Person;
})()

for (var i = 0; i < 1000; ++i) {
  var p= new Person();
  p.getAge();
}
ready
function expression
function person(){
        var _age = 5;

        function getAge(){
                return _age;
        }

        return {
                getAge: getAge
        }
}


for (var i = 0; i < 1000; ++i) {
  var p= new person();
  p.getAge();
}
ready

Revisions

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