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
var test1 = function() {
var private = {};
var test1 = function() {
private.first = 1;
private.second = 2;
private.third = 3;
};
test1.prototype.first = function(val) {
if(typeof val === 'number') {
private.first = val;
}
console.debug(private.first);
};
test1.prototype.second = function(val) {
if(typeof val === 'number') {
private.second = val;
}
console.debug(private.second);
};
test1.prototype.third = function(val) {
if(typeof val === 'number') {
private.third = val;
}
console.debug(private.third);
};
return new test1();
};
var test2 = function() {
this.first = 1;
this.second = 2;
this.third = 3;
};
test2.prototype.first = function(val) {
if(typeof val === 'number') {
this.first = val;
}
console.debug(this.first);
};
test2.prototype.second = function(val) {
if(typeof val === 'number') {
this.second = val;
}
console.debug(this.second);
};
test2.prototype.third = function(val) {
if(typeof val === 'number') {
this.third = val;
}
console.debug(this.third);
};
Ready to run.
Test | Ops/sec | |
---|---|---|
With Private Properties |
| ready |
Without Private Properties |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.