312319sakd1231231 (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script>
function Person() {
    this._age = Math.random();
}

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

Person.prototype.ageGetterSetterArgLen = function(age) {
    if(arguments.length === 0) {
        return this._age;
    } else {
        this._age = age;
        return this;
    }
};

Person.prototype.ageGetterSetterUndef = function(age) {
    if(age == null) {
        return this._age;
    } else {
        this._age = age;
        return this;
    }
};
var a = new Person();

function fun( a ) {

return a.age() === 3;
}

function ageGetterSetterArgLen( a ) {

return a.ageGetterSetterArgLen() === 3;
}

function ageGetterSetterUndef( a ) {

return a.ageGetterSetterUndef() === 3;
}

function prop( a ) {
 return a._age === 3;
}

</script>

Setup

var a = new Person();

Test runner

Ready to run.

Testing in
TestOps/sec
fun
if (fun(a)) die
ready
prop
if (prop(a)) die
ready
ageGetterSetterUndef
if (ageGetterSetterUndef(a)) die
ready
ageGetterSetterArgLen
if (ageGetterSetterArgLen(a)) die
ready

Revisions

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