Array VS Iterrator (v6)

Revision 6 of this benchmark created on


Setup

function generateData(size) {
    return Array.from({ length: size }, (_, i) => i);
}

const arr = generateData(100);
const TAKE_NO = Math.floor(Math.random() * 5000);
const DROP_NO = Math.floor(Math.random() * 1000);

Teardown

// console.log(arr_res.length == iter_res.length ? 'CORRECT' : 'UNEQUAL DATA PASSED')

Test runner

Ready to run.

Testing in
TestOps/sec
Array
const arr_res = arr.map(el => el *3).slice(10,5)
ready
Iterrator
const iter_res = arr.values().map(el => el *3).drop(10).take(5).toArray()
ready

Revisions

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