Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Iterators vs Arrays
(version: 1)
Comparing performance of:
Arrays vs Iterator
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Tests:
Arrays
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; arr.filter(n => n % 2 === 0).map(n => ({ result: n })).forEach(n => console.log("n = ", n));
Iterator
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; const iterator = Iterator.from(arr); iterator.filter(n => n % 2 === 0).map(n => ({ result: n })).forEach(n => console.log("n = ", n));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Arrays
Iterator
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser/OS:
Firefox 145 on Ubuntu
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Arrays
14871.7 Ops/sec
Iterator
13378.6 Ops/sec
Related benchmarks:
for loop push vs mapFilter
forEach vs for vs while
for vs for in vs for each vs for of
forEach vs filtermap
forEach vs filtermap2
Fastest iteration over array: map vs forEeach vs while vs for loop (fixed)
Odd sorrting
JS Iteration - Test1
Array filter vs for ...of loop
Comments
Confirm delete:
Do you really want to delete benchmark?