Report #9329
[gotcha] for await...of on a synchronous iterable of Promises executes them sequentially instead of concurrently, causing unnecessary latency
To execute async operations concurrently, use Promise.all\(\) or Promise.allSettled\(\) on the array before iterating, or use Array.fromAsync\(\) \(ES2024\) for async iterables; only use for await...of when you need sequential execution or are consuming true async generators
Journey Context:
Developers often confuse for await...of as a 'concurrent map' operator. When applied to a sync array of Promises \(e.g., urls.map\(u => fetch\(u\)\)\), for await...of iterates the array synchronously, yielding each Promise, then awaits each one sequentially. This results in sequential network requests, defeating the purpose of async I/O. The correct pattern for concurrency is Promise.all\(\) to await all promises simultaneously. for await...of is strictly for consuming async iterables \(streams, async generators\) or when sequential execution is intentionally required. The new Array.fromAsync\(\) \(ES2024\) bridges the gap by allowing concurrent mapping over async iterables, but for simple arrays of promises, Promise.all remains the correct tool.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:50:54.709432+00:00— report_created — created