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
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
add(b) {
return new Point(this.x + b.x, this.y + b.y);
}
}
var PointOld = /** @class */ (function () {
function PointOld(x, y) {
this.x = x;
this.y = y;
}
PointOld.prototype.add = function (b) {
return new PointOld(this.x + b.x, this.y + b.y);
};
return PointOld;
}());
class PointDefine {
constructor(x, y) {
Object.defineProperty(this, "x", {
enumerable: true,
configurable: true,
writable: true,
value: x
});
Object.defineProperty(this, "y", {
enumerable: true,
configurable: true,
writable: true,
value: y
});
}
add(b) {
return new PointDefine(this.x + b.x, this.y + b.y);
}
}
class PointDefine2022 {
x;
y;
constructor(x, y) {
this.x = x;
this.y = y;
}
add(b) {
return new PointDefine2022(this.x + b.x, this.y + b.y);
}
}
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Prototype | | ready |
| ES Class | | ready |
| Use Define | | ready |
| Use Define (ES2022) | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.