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
Go 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
Array.indexOf
94K/s
Array.find
2K/s
View exact numbers
Test name
Executions per second
✓
Array.indexOf
93,637 Ops/sec
Array.find
2,299 Ops/sec
Related benchmarks
JS find vs indexOf
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?