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 Person1(name) {
this.name = name;
}
Person1.prototype.get_name = function() {
return this.name;
};
Person1.prototype.set_name = function(name) {
this.name = name;
};
var Person2 = function(name) {
var p = {
name: name
};
return {
get_name: function () {
return p.name;
},
set_name: function (name) {
p.name = name;
}
};
};
function get_name(p) {
return p.name;
}
function set_name(p, name) {
p.name = name;
}
var Person3 = function (name) {
var p = {
name: name
};
return {
get_name: get_name.bind(null, p),
set_name: set_name.bind(null, p),
}
};
var p1 = new Person1('John');
var p2 = Person2('John');
var p3 = Person3('John');
Ready to run.
Test | Ops/sec | |
---|---|---|
Closure write |
| ready |
Closure 2 init |
| ready |
Closure 2 read |
| ready |
Closure 2 write |
| ready |
Closure read |
| ready |
Prototype write |
| ready |
Prototype read |
| ready |
Closure init |
| ready |
Prototype init |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.