Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
set vs array iteration for,for-of and values v2
(version: 1)
Comparing performance of:
array for-of vs set for-of vs array for vs set values for-of
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; var b = new Set(a);
Tests:
array for-of
for (const x of a) { let z = x; }
set for-of
for (const x of b) { let z = x; }
array for
for (let i = 0; i < a.length; i++) { let x = a[i]; }
set values for-of
const v = b.values(); for (const x of v) { let z = x }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
array for-of
set for-of
array for
set values for-of
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
array for-of
16424402.0 Ops/sec
set for-of
13196301.0 Ops/sec
array for
873078.4 Ops/sec
set values for-of
13438799.0 Ops/sec
Related benchmarks:
foreach vs for vs for in
set vs array iteration
set vs array iteration 100kf
for vs foreach vs for..of vs for..of over entries (const) etc
set vs array iteration new
set vs array iteration new new
set vs array iteration for,for-of and values
set vs array iteration for,for-of and values v3
set vs array vs map iteration for,for-of and values with init
Comments
Confirm delete:
Do you really want to delete benchmark?