iterable vs iterator (v2)

Revision 2 publishedon

Setup

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

function* gen() {
	let limit = 1000;
	while (limit--) {
		yield 999 - limit;
	}
}

const getIterator = () => gen()

Test Runner

Initializing...

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