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 myArr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
function fp(arr) {
return arr
.filter(num => num % 2)
.map(num => num * 2)
.reduce((acc, currVal) => acc + currVal, 0)
}
function proc(arr) {
let total = 0
for(let i = 0; i < arr.length; i++) {
const num = arr[i]
if(num % 2) {
total += num * 2
}
}
return total
}
function fpFlat(arr) {
return arr
.flatMap(num => num % 2 !== 0 ? [num * 2] : [])
.reduce((acc, currVal) => acc + currVal, 0)
}
Ready to run.
Test | Ops/sec | |
---|---|---|
FP |
| ready |
PROC |
| ready |
FP FLAT |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.