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 N = 10_000
const needle = 5_000
const A = []
for (let i = 0; i < N; i++) {
A.push({ i })
}
const B = new Array(N)
for (let i = 0; i < N; i++) {
B[i] = { i }
}
const C = []
for (let i = 0; i < N; i++) {
C.push(i)
}
Array.prototype.manualFindIndex = function(pred) {
for (let i = 0; i < this.length; i++) {
if (pred(this[i])) return i
}
}
Array.prototype.iterFindIndex = function(pred) {
for (const [i, o] of this.entries()) {
if (pred(o)) return i
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
findIndex |
| ready |
manual |
| ready |
iter |
| ready |
findIndexSparse |
| ready |
manualSparse |
| ready |
iterSparse |
| ready |
findIndexSmallInteger |
| ready |
manualSmallInteger |
| ready |
iterSmallInteger |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.