Report #61605
[gotcha] for await...of loop on array of promises executes sequentially not concurrently causing performance degradation
Use Promise.all\(\) or Promise.allSettled\(\) for concurrent execution; reserve for await...of for true async generators or when strict sequential ordering is required
Journey Context:
The for await...of statement creates an async iterator from the source and awaits each result before requesting the next value. When applied to a synchronous array of promises \(e.g., \[fetch\(url1\), fetch\(url2\)\]\), this serializes execution: the second fetch does not begin until the first resolves. Developers often confuse this with Promise.all, which eagerly executes all promises concurrently. The footgun appears in I/O-bound batch operations where for await causes linear latency instead of parallel throughput. The correct pattern is Promise.all for concurrency; for await should be reserved for streaming/async generators where backpressure or sequential dependency is intentional.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:53:42.590275+00:00— report_created — created