Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Check for equal value at given index
(version: 1)
Testing the difference between native loops and find()
Comparing performance of:
for-loop vs Array.find()
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id='test'></div>
Tests:
for-loop
var arr = ['hello', 'a', 'b']; var arr2 = ['c', 'a', 'z']; let val; for(i=0; i<arr.length; i++){ if (arr2[i] === arr[i]) { val = arr[i]; break; } }
Array.find()
var arr = ['hello', 'a', 'b']; var arr2 = ['c', 'a', 'z']; let val = arr.find((node, i) => node === arr2[i]);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
for-loop
Array.find()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
for-loop
13837749.0 Ops/sec
Array.find()
96447920.0 Ops/sec
Related benchmarks:
find() vs for...of vs for-loop
find() vs for...of vs for-loop multi variable
find() vs for...of vs for-loop multi variable with switches
For-loop vs For-Of vs Array.find
find() vs for...of vs for-ggggloop
find() vs for...of vs for-loop with large arrays
find() vs for...of vs for-loop 2
for...in vs for...of vs for-loop
find() vs for...of vs for-loop v2
Comments
Confirm delete:
Do you really want to delete benchmark?