Parent: #459 Depends on: #460, #465, #467, #468
Goal
Optimize promises, async functions/generators, generators, microtasks, modules, and dynamic import as real application pipelines rather than isolated semantic features.
Scope
- Reduce promise/reaction/job allocation and queue traffic with bounded owned storage and exact FIFO/realm semantics.
- Optimize settled-promise fast paths,
awaitsuspend/resume, async stack metadata, generator activation reuse, and async-generator request queues. - Compile suspend/resume states through VM/native tiers with precise roots, handler/finally state, debugger visibility, and cancellation/termination checkpoints.
- Optimize static/dynamic module graph loading, linking, namespace access, top-level await propagation, import attributes/defer, cache lookup, and graph teardown.
- Profile worker/module lifecycle and shared/no-GIL microtask contention separately from single-context behavior.
No-workaround rules
- No synchronous promise shortcut that changes job ordering, swallowed rejection, missing async stack, pooled activation with observable stale state, bypassed host hook, or unbounded module/job cache.
- Network/filesystem loading remains an embedder/provider boundary; benchmarks use deterministic in-memory owned fixtures.
Acceptance
- #460 adds promise chains, fan-in/fan-out, async loops, generators, async generators, module graphs, dynamic import, TLA, errors, and worker rows.
- Forced tree/VM/native differentials preserve values, errors, job ordering, stacks, hooks, and exact suspend/resume state.
- Moving GC, finalization, OOM, teardown, debugger, no-GIL, Worker, TSan, and lifecycle fuzz gates pass.
- Profiles prove reductions in allocations, queue locks, resumes, runtime dispatch, and graph teardown cost with bounded memory.
- Directly comparable expanded rows meet #459 performance gates without regressing existing call/closure rows.
Foundation
Existing runtime: src/promise.zig, VM activation stack, module graph in src/context.zig, Worker infrastructure under #1.