Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS iterator vs array
(version: 1)
Comparing performance of:
Array vs Iterator
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const items = [1,2,3,4,5,6,7,8,9,10];
Tests:
Array
const arrayTransform = items.filter(i => i % 2 === 0).map(n => n * 2);
Iterator
const iterTransform = items.values().filter(i => i % 2 === 0).map(n => n * 2).toArray();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array
Iterator
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.7 Mobile/15E148 Safari/604.1 Ddg/18.7
Browser/OS:
Mobile Safari 18 on iOS 18.7.1
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array
7567264.0 Ops/sec
Iterator
1684724.6 Ops/sec
Related benchmarks:
foreach vs map vs for in v2
for vs for...of vs Array.forEach
for vs foreach vs some vs for..of (that really works) 2
For i / For of / ForEach
iterate over array
Array loop vs foreach vs map into array 2
javascript rulettaa
javascript ruletz
Array with Objects loop
Comments
Confirm delete:
Do you really want to delete benchmark?