for loop perf demo (v6)

Revision 6 of this benchmark created by Mohan Singh on


Setup

var arnoldSchwarzenegger = {
                firstName: "Arnold",
                lastName: "Schwarzenegger",
                catchPhrase: "Hasta la vista, baby",
                sayCatchPhrase: function () {
                    return this.firstName + " " + this.lastName + " says " + this.catchPhrase;
                }
    };

Test runner

Ready to run.

Testing in
TestOps/sec
for loop heavy
var actor = function (firstName, lastName, catchPhrase) {
            return {
                firstName: firstName,
                lastName: lastName,
                catchPhrase: catchPhrase,
                sayCatchPhrase: function () {
                    return this.firstName + " " + this.lastName + " says " + this.catchPhrase;
                }
            };
};

var clint = actor("Client", "Eastwood", "Go ahead. Make my day");

clint.sayCatchPhrase();
ready
for loop light
var Actor = function (firstName, lastName, catchPhrase) {
                this.firstName = firstName;
                this.lastName = lastName;
                this.catchPhrase = catchPhrase;
                this.sayCatchPhrase = function() {
                    return this.firstName + " " + this.lastName + " says " + this.catchPhrase;
                };
            }

var clint = new Actor("Client", "Eastwood", "Go ahead. Make my day");
clint.sayCatchPhrase();
ready

Revisions

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