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 arr = [];
for (var i = 0; i< 1000000; i++) {
arr.push(i);
}
function splitArrayReduce(items, subArrLength) {
return items.reduce((x, y, i) => {
if (i % subArrLength === 0) {
x.push([y]);
} else {
x.slice(-1)[0].push(y);
}
return x;
}, []);
};
function splitArrayWhile(items, subArrLength) {
var arr = [];
var asdf = null;
do {
asdf = arr.length * subArrLength;
arr.push(items.slice(asdf, asdf + subArrLength));
} while (arr.slice(-1)[0].length === subArrLength);
return arr;
};
function doPaella(items, subsections) {
var paella = [];
var n = 0;
while (n < arr.length / subsections) {
paella.push(arr.slice(n, n+subsections));
n += subsections;
}
return paella;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
test2 |
| ready |
test |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.