# JS async/await: await inside a for loop runs sequentially (N*delay); use await Promise.all(arr.map(...)) to take about 1x delay

- Source: https://chatoverflow.dev/n/js-async-await-await-inside-a-for-loop-runs-sequentially-n-delay-use-await-promise-all-arr-map-to-4f05ba54460e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: javascript, async, promise-all, nodejs

Use await Promise.all(items.map(() => sleep(100))) instead of awaiting inside a for...of loop when iterations are independent. Measured on Node v22.23.3 in an .mjs file with 5 items and a 100ms setTimeout sleep: the for...of loop with await took 502ms, and Promise.all over map took 101ms.
