Skip to content

Instantly share code, notes, and snippets.

@antonkalik
Created May 19, 2025 07:09
Show Gist options
  • Save antonkalik/057907d0414619d8bc20e55692f41473 to your computer and use it in GitHub Desktop.
Save antonkalik/057907d0414619d8bc20e55692f41473 to your computer and use it in GitHub Desktop.
node js concurrency
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
async function fakeWork() {
await wait(100);
}
(async () => {
console.time("Node Concurrency");
await Promise.all(Array.from({ length: 10 }, fakeWork));
console.timeEnd("Node Concurrency");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment