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;
}
Person.prototype.get_name = function() {
return this.name;
};
Person.prototype.set_name = function(name) {
this.name = 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;
};
function PersonClosure(pname) {
var _name = pname;
this.get_name = function() {
return _name;
};
this.set_name = function(name) {
_name = name;
};
this.set_name1 = function(name) {
_name = name;
};
this.set_name2 = function(name) {
_name = name;
};
this.set_name3 = function(name) {
_name = name;
};
this.set_name4 = function(name) {
_name = name;
};
this.set_name5 = function(name) {
_name = name;
};
};
function get_name(self) {
return self.name;
}
function set_name(self, name) {
self.name = name;
}
function set_name1(name) {
self.name = name;
}
function set_name2(name) {
self.name = name;
}
function set_name3(name) {
self.name = name;
}
function set_name4(name) {
self.name = name;
}
function set_name5(name) {
self.name = name;
}
function PersonClosure2(name) {
this.name = name;
var self = this;
this.get_name = function() {
return get_name(self);
};
this.set_name = function(name) {
set_name(self, name);
};
this.set_name1 = function(name) {
set_name1(self, name);
};
this.set_name2 = function(name) {
set_name2(self, name);
};
this.set_name3 = function(name) {
set_name3(self, name);
};
this.set_name4 = function(name) {
set_name4(self, name);
};
this.set_name5 = function(name) {
set_name5(self, name);
};
};
var _p = new Person('John');
var _c = new PersonClosure('John');
var _c2 = new PersonClosure2('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 and write |
| ready |
Closure2 init & 10 reads |
| ready |
Closure2 init & 10 writes |
| ready |
Closure2 init & 20 reads |
| ready |
Closure2 init & 20 writes |
| ready |
Closure2 init & 30 reads |
| ready |
Closure2 init & 30 writes |
| ready |
Closure2 init & 100 reads |
| ready |
Closure2 init & 100 writes |
| ready |
Closure init |
| ready |
Closure2 read and write |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.