import { mapMany } from "./mapMany.js"; const concatenate = async (letter: string) => `${letter}+${letter}`; const main = async () => { const urls = [ "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", "a", "b", "c", "a", "a", "b", "c", "a", "a", "b", ]; console.log("Normal map with unlimited concurrency"); console.time("normalmap"); const results1 = await Promise.all(urls.map(concatenate)); console.timeEnd("normalmap"); console.log("Map many with 10 concurrency"); console.time("mapMany"); const results2 = await mapMany(urls, concatenate, 10); console.timeEnd("mapMany"); }; main();