Created
May 19, 2025 07:09
-
-
Save antonkalik/057907d0414619d8bc20e55692f41473 to your computer and use it in GitHub Desktop.
node js concurrency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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