Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
set vs array iteration for,for-of and values v3
(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 = []; for (var i = 0; i <= 10000; i++) { a.push(i); } 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
519681.2 Ops/sec
set for-of
108421.9 Ops/sec
array for
919.2 Ops/sec
set values for-of
109745.1 Ops/sec
Related benchmarks:
push vs apply.push vs spread
for vs foreach vs for..of (z)
forEach vs for ... of
DDS Array vs Set - performance v4
set vs array iteration 100kf
for vs foreach vs for..of vs for..of over entries (const) etc
set vs array iteration for,for-of and values
set vs array iteration for,for-of and values v2
set vs array vs map iteration for,for-of and values with init
Comments
Confirm delete:
Do you really want to delete benchmark?