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 list = new Set(Array.from({ length: 10000 }, (_, val) => val + 1))
const target = 9112
function forOf(list, target) {
for (const val of list) {
if (val === target) {
return val
}
}
}
function forEach(list, target) {
list.forEach((val) => {
if (val === target) {
return val
}
})
}
function forValues(list, target) {
for (let it = list.values(), val = null; val = it.next().value;) {
if (val === target) {
return val
}
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
for-of |
| ready |
for-of array |
| ready |
forEach |
| ready |
forValues |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.