The shuttle_async library, built on C++23 stackless coroutines, serves as the asynchronous foundation for the ShuttleEngine game engine. It utilizes a decentralized Work Stealing balancer based on Chase-Lev deques to manage task distribution across CPU threads, avoiding the overhead of OS-level thread synchronization and context switching.
Performance testing on an Intel Core i9-14900KF processor, featuring 24 cores and 32 threads, demonstrated significant scaling. The system achieved superlinear acceleration in the 1–8 worker range due to efficient L1/L2 cache utilization. As the load increased to 32 threads, the system reached a peak performance gain of 25.2x–26.2x.
Memory management for coroutine frames and shared states is handled via the mimalloc allocator to ensure deterministic, nanosecond-level allocation times. This approach avoids the latency issues associated with standard heap allocations during critical rendering paths.
To manage the asynchronous task lifecycle, the library implements Structured Concurrency through CoroScope and JoinableScope components. A specialized joinTask mechanism prevents premature destruction of parent coroutine frames by ensuring all child tasks complete before the parent's resources are released.






