“C++ Coroutines - a negative overhead abstraction"
summary
Claims that C++17 coroutines act as a negative-overhead abstraction: implemented an awaitable interface with await_ready/await_suspend/await_resume, glued to OS I/O via a void context so callbacks reconstitute and resume coroutines. Builds a coroutine-based adapter over raw C networking APIs, shows a read-loop example, and measures roughly 2x speedup after optimizations, smaller binary/object sizes versus callback state machines (hello-world baseline ~9 KB) and much lower per-operation overhead once synchronous-completion and allocation workarounds are applied.
AI-written summary · about
chapters (18)
- 0:00Introduction to C++ coroutines
- 1:55History of coroutines
- 7:34Negative overhead abstraction
- 8:38Transition to modern examples
- 9:00Synchronous vs asynchronous state machines
- 10:05Traditional async models in C++
- 15:52State machine implementation
- 18:55Callback-based async patterns
- 19:17Coroutines and await keyword
- 21:49Performance comparison
- 26:28Awaitable concept explained
- 31:06Implementing async read with coroutines
- 32:36Optimizing async operations
- 37:34Profiling and allocations
- 40:07Philosophy behind coroutines
- 42:35Design principles for coroutines
- 45:02C++ coroutines status and future
- 46:08Q&A session
related talks
58m“Introduction to C++ Coroutines"
01h 20mCoroutines for Dummies
57mC++ Coroutines: Under the covers
01h 30mC++ Coroutines and Structured Concurrency in Practice
48m“Coroutines: what can't they do?”
01h 01mUnderstanding C++ Coroutines by Example, Part 1
01h 16mC++ Feature Coroutines, Beginner Friendly
55mPutting Coroutines to Work with the Windows Runtime
