Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
set vs array iteration for,for-of and values
(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) {}
set for-of
for (const x of b) {}
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) { }
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:
11 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
array for-of
62065684.0 Ops/sec
set for-of
33438052.0 Ops/sec
array for
26000000.0 Ops/sec
set values for-of
32998842.0 Ops/sec
Related benchmarks:
set vs array iteration
set vs array iteration 100k elements
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 v2
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?