Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
find reversed for loop versus find method 4
(version: 1)
Comparing performance of:
reversed for loop vs find method => vs find method function
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = []; for (let i = 0 ; i < 10000 ; i++) { array.push ({ value: Math.floor (Math.random () * 1000) }); }
Tests:
reversed for loop
const value = Math.floor (Math.random () * 100000); let found = undefined; for (let i = array.length - 1 ; i >= 0 ; i--) { const cell = array[i]; if (cell.value === value) { found = cell; break; } }
find method =>
const value = Math.floor (Math.random () * 100000); let found = array.find ((cell) => cell.value === value);
find method function
const value = Math.floor (Math.random () * 100000); let found = array.find (function (cell) { return cell.value === value });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
reversed for loop
find method =>
find method function
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
reversed for loop
48208.9 Ops/sec
find method =>
43890.9 Ops/sec
find method function
46727.8 Ops/sec
Related benchmarks:
for vs for (reverse with length) vs every vs forEach with big array
for vs for (reverse with length) vs every vs forEach with big array 2
for vs for (reverse with length) vs every vs forEach with small array 2
for vs for (with length) vs for (reverse with length) vs every vs forEach with small array 2
reversed versus ordered (+ cached)
ordered versus reversed (+ cached)
sort vs reverse test 2
find reversed for loop versus find method
find reversed for loop versus find method 2
Comments
Confirm delete:
Do you really want to delete benchmark?