const { List } = require('immutable');
const ITEM_IN_LIST = 1000000;
const ITEM_TO_FIND = 5000;
function getAHugeList() {
return List(Array(ITEM_IN_LIST).fill(null).map(() => Math.floor(ITEM_IN_LIST * Math.random())));
}
function timeFunction(name, callback) {
console.time(name);
callback();
console.timeEnd(name);
}
const l = getAHugeList();
const findItem= (i) => i === ITEM_TO_FIND;
timeFunction('find', () => l.find(findItem));
timeFunction('some', () => l.some(findItem));