Report #11649
[gotcha] Async generator yield\* causes unexpected microtask delays compared to manual iteration
yield\* delegates to the async iterator protocol, introducing additional microtask ticks per iteration step compared to synchronous generators. For deterministic timing or backpressure, manually iterate with for-await-of and yield values individually rather than using yield\*.
Journey Context:
In synchronous generators, yield\* is essentially syntactic sugar that iterates the inner iterable and yields each value immediately. In async generators, the semantics are strictly defined by the async iterator protocol: yield\* must await the inner generator's next\(\) promise, then await any potential value unpacking, creating at least one microtask delay per iteration. This compounds in deep async generator stacks \(yield\* of yield\*\), creating 'microtask death by a thousand cuts' that can cause starvation of macrotasks or observable timing differences in tests. This also affects backpressure: the inner generator may produce values faster than the outer yield\* consumes them due to the async boundary. Manual iteration with for-await-of allows explicit control over promise resolution timing and backpressure management.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:50:41.260195+00:00— report_created — created