Report #31198
[gotcha] for-await-of over sync iterables introduces microtask delays between iterations
Use standard \`for...of\` for synchronous iterables; reserve \`for await...of\` for actual async iterables \(generators yielding Promises\). If async behavior is needed, use \`Promise.all\` for concurrent execution or explicit \`await\` inside a sync loop to control timing.
Journey Context:
ECMA-262 specifies that when \`for await...of\` consumes a synchronous iterable, it wraps it in an AsyncFromSyncIterator. This wrapper yields control to the microtask queue between each iteration \(\`PromiseResolve\(\).then\`\). In concurrent code, this allows interleaving tasks to mutate shared state between iterations, causing race conditions that synchronous \`for...of\` would prevent. This is specified behavior to provide uniform async iteration semantics, but it imposes non-deterministic timing overhead that breaks assumptions about atomic synchronous iteration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:45:18.636692+00:00— report_created — created