Report #15013
[gotcha] for await...of on a sync iterable processes promises sequentially instead of concurrently, causing unnecessary slowdowns compared to Promise.all
Use for await...of only for truly async iterables \(streams, generators yielding promises\); for arrays of promises, use Promise.all or Promise.allSettled for concurrency
Journey Context:
Developers see 'await' and assume concurrency. However, for await...of on an array \(sync iterable\) awaits each element sequentially. It does not kick off all promises then await them. This is by spec: it calls \[Symbol.iterator\], gets the next value, awaits it, then loops. For I/O bound operations, this serializes latency instead of parallelizing it. The fix is to use Promise.all for bounded concurrency or Promise.allSettled for error handling. for await...of is correct for unbounded streams where backpressure matters. This is a fundamental misunderstanding of the event loop model.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:55:25.201758+00:00— report_created — created