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 small = [{kind: "user", data: {}},{kind: "agent", data: {}}]
const big = Array.from({length: 1000}).flatMap(() => small)
function filterMap(array, map) {
if (array.length === 0) {
return array
}
const out = []
for (const item of array) {
const mapped = map(item)
if (mapped !== undefined) {
out.push(mapped)
}
}
return out
}
Ready to run.
Test | Ops/sec | |
---|---|---|
.flatMap (2000) |
| ready |
filterMap (2000) |
| ready |
.flatMap |
| ready |
filterMap |
| ready |
.map.filter (2000) |
| ready |
.map.filter |
| ready |
.map().filter(Boolean) (2000) |
| ready |
.map().filter(Boolean) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.