jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
// Regular constructor
var conPerson = function(name, lastName) {
this._name = name;
this._lastName = lastName;
this._address = null;
this._phone = null;
this.setAdress = function(address) {
this._address = address;
};
this.setPhone = function(phone) {
this._phone = phone;
};
this.toString = function() {
console.log('[Person]: ' + this._name + ' ' + this._lastName + '\n[Address]: ' + this._address + '\n[Phone]: ' + this._phone);
};
};
// Literal
var lPerson = {
_name: '',
_lastName: '',
_address: '',
_phone: '',
init: function (name, lastName) {
this._name = name;
this._lastName = lastName;
return this;
},
setAdress: function(address) {
this._address = address;
},
setPhone: function(phone) {
this._phone = phone;
},
toString: function() {
console.log('[Person]: ' + this._name + ' ' + this._lastName + '\n[Address]: ' + this._address + '\n[Phone]: ' + this._phone);
}
};
var heranca1 = function(){
conPerson.apply(this);
}
var heranca2 = function(){
}
heranca2.prototype = lPerson;
var heranca3 = function(){
}
heranca3.prototype = new conPerson();
Ready to run.
Test | Ops/sec | |
---|---|---|
heranca1 |
| ready |
heranca2 |
| ready |
heranca3 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.