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() {
return (function() {
var private = {};
var init = function() {
private.first = 1;
private.second = 2;
private.third = 3;
};
var test1 = function() {
init();
};
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.