Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for vs foreach vs some vs for..of (1 million)
(version: 1)
Comparing performance of:
for vs foreach vs some vs for..of
Created:
9 months ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var array = new Array(1000000);
Tests:
for
for (var i = 0; i < array.length; i++) { array[i]; }
foreach
array.forEach(function(i) { array[i]; });
some
array.some(function(i) { array[i]; });
for..of
for (var i of array) { array[i]; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
for
foreach
some
for..of
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.1 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 26 on iOS 18.7
View result in a separate tab
Embed
Embed Benchmark Result
for
5K/s
some
79/s
foreach
75/s
for..of
60/s
View exact numbers
Test name
Executions per second
✓
for
4,850 Ops/sec
some
79 Ops/sec
foreach
75 Ops/sec
for..of
60 Ops/sec
Related benchmarks
for vs for..of vs forEach
for vs foreach vs some vs for..of (x10000)
Comments
Confirm delete:
Do you really want to delete benchmark?