Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
find vs findIndex vs loop for
(version: 1)
Measuring which is faster
Comparing performance of:
Array.prototype.find vs Array.prototype.findIndex vs for loop
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
Array.prototype.find
const item = arr.find(item => item == 1E5);
Array.prototype.findIndex
const index = arr.findIndex(item => item == 1E5);
for loop
let index = -1; for(let i = 0; i < arr.length; i++) { arr[i] == 1E5; index = i; break; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.prototype.find
Array.prototype.findIndex
for loop
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser/OS:
Chrome 146 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.prototype.find
2250.1 Ops/sec
Array.prototype.findIndex
2341.7 Ops/sec
for loop
191075072.0 Ops/sec
Related benchmarks:
find vs findIndex (Array prototype methods)
find vs findIndex (Array prototype methods) 22
find vs findindex with condition test
find vs findIndex (Array prototype methods) 2
find vs findIndex (Array prototype methods) object
find vs findIndex get item
find vs findIndex (Array prototype methods) vs indexOf
find vs findIndex with accesing the elemnt through index
find vs findIndex vs loop for 2
Comments
Confirm delete:
Do you really want to delete benchmark?