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
function VanillaPerson(name, surname,email,address,city,state,zip) {
if (!(this instanceof VanillaPerson)) {
return new VanillaPerson(name,surname,email,address,city,state,zip);
}
this.name = name;
this.surname = surname;
this.email = email;
this.address = address;
this.city = city;
this.state = state;
this.zip = zip;
}
function Person(obj) {
if (!(this instanceof Person)) {
return new VanillaPerson(obj);
}
this.name = obj.name;
this.surname = obj.surname;
this.email = obj.email;
this.address = obj.address;
this.city = obj.city;
this.state = obj.state;
this.zip = obj.zip;
}
function struct(props) {
function Struct(obj) {
// make `new` optional
if (!(this instanceof Struct)) return new Struct(obj);
// add props
var name;
for ( var i = 0, len = props.length ; i < len ; i++ ) {
name = props[i];
this[name] = obj[name];
}
}
return Struct;
}
var StructPerson = struct(['name','surname','email','address','city','state','zip']);
var person;
Ready to run.
Test | Ops/sec | |
---|---|---|
new VanillaPerson |
| ready |
new Person |
| ready |
new StructPerson |
| ready |
VanillaPerson |
| ready |
Person |
| ready |
StructPerson |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.