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
const createArr = (length) => Array.from(
{ length },
(_, index) => index % 2 === 0
);
const items = {
100: createArr(100),
1000: createArr(1000),
10000: createArr(10000),
100000: createArr(100000),
1000000: createArr(1000000),
};
const toSelected = items => items
.map((val, idx) => ({ val, idx }))
.filter(v => !!v.val)
.map(v => v.idx);
const selected = {
100: toSelected(items[100]),
1000: toSelected(items[1000]),
10000: toSelected(items[10000]),
100000: toSelected(items[100000]),
1000000: toSelected(items[1000000]),
};
const toObj = items => items
.reduce((acc, cur, idx) => {
if (cur) {
acc[idx] = cur;
}
return acc;
}, {});
const map = {
100: toObj(items[100]),
1000: toObj(items[1000]),
10000: toObj(items[10000]),
100000: toObj(items[100000]),
1000000: toObj(items[1000000]),
};Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Array.prototype.includes 100 | | ready |
| map 100 | | ready |
| Array.prototype.includes 1000 | | ready |
| map 1000 | | ready |
| Array.prototype.includes 10000 | | ready |
| map 10000 | | ready |
| Array.prototype.includes 100000 | | ready |
| map 100000 | | ready |
| Array.prototype.includes 1000000 | | ready |
| map 1000000 | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.