iterable vs iterator

Benchmark publishedon

Setup

const iterable = [...(new Array(1000))].map((_,i) => i)
const iterator = iterable.values()

Test Runner

Initializing...

Testing in
Test CaseOps/sec
iterable
iterable.map(x => x * 2).filter(x => x < -1).reduce((a,b) => a+b, 0)
ready
iterator
iterator.map(x => x * 2).filter(x => x < -1).reduce((a,b) => a+b, 0)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

Revision 1
publishedon
Revision 2
publishedon