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 Person(name) {
this.name = name;
this.set_name = function(name) {
this.name = name;
};
}
Person.prototype.get_name = function() {
return this.name;
};
Person.prototype.set_name1 = function(name) {
this.name = name;
};
Person.prototype.set_name2 = function(name) {
this.name = name;
};
Person.prototype.set_name3 = function(name) {
this.name = name;
};
Person.prototype.set_name4 = function(name) {
this.name = name;
};
Person.prototype.set_name5 = function(name) {
this.name = name;
};
var person = function(pname) {
var rev = new Object();
rev.pname = pname;
rev.get_name = function(){
return rev.pname;
}
rev.set_name = function(name){
rev.pname = name;
}
rev.set_name2 = function(name){
rev.pname = name;
}
rev.set_name3 = function(name){
rev.pname = name;
}
rev.set_name4 = function(name){
rev.pname = name;
}
rev.set_name5 = function(name){
rev.pname = name;
}
return rev;
};
var _p = new Person('John');
var _c = person('John');
Ready to run.
Test | Ops/sec | |
---|---|---|
Prototype init & 10 reads |
| ready |
Closure init & 10 reads |
| ready |
Prototype init & 10 writes |
| ready |
Closure init & 10 writes |
| ready |
Prototype init & 20 reads |
| ready |
Closure init & 20 reads |
| ready |
Prototype init & 20 writes |
| ready |
Closure init & 20 writes |
| ready |
Prototype init & 30 reads |
| ready |
Closure init & 30 reads |
| ready |
Prototype init & 30 writes |
| ready |
Closure init & 30 writes |
| ready |
Prototype init & 100 reads |
| ready |
Closure init & 100 reads |
| ready |
Prototype init & 100 writes |
| ready |
Closure init & 100 writes |
| ready |
Prototype init |
| ready |
Closure init |
| ready |
Prototype read and write |
| ready |
Closure read |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.