Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
find vs findIndex (Array prototype methods) 123123
Measuring which is faster
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0
Browser:
Chrome 122
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Array.prototype.findIndex
171.9 Ops/sec
Array.prototype.findIndex (rev)
174.0 Ops/sec
Script Preparation code:
var arr = []; var i = 0; var arrRev = []; var j = 0; var SIZE = 1E5; var middle = Math.floor(SIZE / 2); while (i <= SIZE) arr[i] = i++; while (j <= SIZE) arrRev[j] = j++;
Tests:
Array.prototype.findIndex
const index = arr.findIndex(item => item == middle);
Array.prototype.findIndex (rev)
const index = arrRev.length - arrRev.reverse().findIndex(item => item == middle) - 1;