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 Vec2(x, y) {
this.x = x||0;
this.y = y||0;
}
Vec2.prototype.set1 = function(x, y) {
this.x = x;
this.y = y;
return this;
};
Vec2.prototype.set2 = function(x, y) {
if (x && (x.x === 0 || x.x)) {
this.x = x.x;
this.y = x.y;
} else {
this.x = x;
this.y = y;
}
return this;
};
Vec2.prototype.set3 = function(x, y) {
if (typeof x === "object") {
this.x = x.x;
this.y = x.y;
} else {
this.x = x;
this.y = y;
}
return this;
};
var v = new Vec2(Math.random(), Math.random());
var v2 = new Vec2(Math.random(), Math.random());
Ready to run.
Test | Ops/sec | |
---|---|---|
nocheck |
| ready |
check1-obj |
| ready |
check1-xy |
| ready |
check2-obj |
| ready |
check2-xy |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.