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
Go 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
Array.find()
96.4M/s
for-loop
13.8M/s
View exact numbers
Test name
Executions per second
✓
Array.find()
96,447,920 Ops/sec
for-loop
13,837,749 Ops/sec
Related benchmarks
find() vs for...of vs for-loop
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?