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 signal() {
var a = Math.random(),
b = Math.random();
return [
function () {
return a;
},
function () {
return b;
},
];
}
function wrap(a) {
return function () {
console.log("start");
var b = a();
console.log("end");
return b;
};
}
function destructureAndNewArray() {
const [get, set] = signal();
return [wrap(get), wrap(set)];
}
function c(a) {
var b = 0;
return function () {
return b < a.length ? { done: !1, value: a[b++] } : { done: !0 };
};
}
function polyfilledDestructureAndNewArray() {
var a = signal();
var b = typeof Symbol != "undefined" && Symbol.iterator && a[Symbol.iterator];
if (b) a = b.call(a);
else if (typeof a.length == "number") a = { next: c(a) };
else throw Error(String(a) + " is not an iterable or ArrayLike");
b = a;
a = b.next().value;
b = b.next().value;
return [wrap(a), wrap(b)];
}
function newArray() {
var a = signal();
return [wrap(a[0]), wrap(a[1])];
}
function mutateArray() {
var a = signal();
a[0] = wrap(a[0]);
a[1] = wrap(a[1]);
return a;
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| destructureAndNewArray | | ready |
| polyfilledDestructureAndNewArray | | ready |
| newArray | | ready |
| mutateArray | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.