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 plainobj(x) {
return {
get x() { return x; },
set x(val) { x = val; }
};
}
class Item {
constructor(x) {
this._x = x;
}
get x() { return this._x; }
set x(val) { this._x = val; }
}
function newclass(x) {
return new class {
get x() { return x; }
set x(val) { x = val; }
}
}
function test(obj) {
obj.x = Math.random();
return obj.x;
}
const ins_plainobj = plainobj(1);
const ins_class = new Item(1);
const ins_newclass = newclass(1);
Ready to run.
Test | Ops/sec | |
---|---|---|
Plain Object getter/setter (closure) |
| ready |
Class (private field) |
| ready |
NewClass (closure) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.