Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
set vs array vs map iteration for,for-of and values v
(version: 1)
Comparing performance of:
array for-of vs set for-of vs array for vs set values for-of vs map values for-of vs map keys for-of vs map kv 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); var c = new Map(a.map(x => [x, x]));
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 }
map values for-of
const v = c.values(); for (const x of v) { let z = x }
map keys for-of
const v = c.keys(); for (const x of v) { let z = c.get(v) }
map kv for-of
for (const [x, y] of c) { let z = x; let w = y; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (7)
Previous results
Fork
Test case name
Result
array for-of
set for-of
array for
set values for-of
map values for-of
map keys for-of
map kv for-of
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?