Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS find vs arr[indexOf ]
(version: 0)
JS find vs indexOf
Comparing performance of:
Array.find vs Array.indexOf
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
Array.find
const item = arr.find(item => item == 1E5);
Array.indexOf
const item = arr[arr.indexOf(1E5)];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.find
Array.indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser/OS:
Chrome 121 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.find
2299.2 Ops/sec
Array.indexOf
93637.0 Ops/sec
Related benchmarks:
JS find vs indexOf
findIndex vs indexOf for simple array 2
JS find vs indexOf 2
find vs indexOf (Array prototype methods)
JS find vs indexOf u
Comments
Confirm delete:
Do you really want to delete benchmark?