C++ Coroutines, from Scratch
summary
Claims C++20 coroutines cut complex async boilerplate and speed database-style object loading by converting a serial 10-roundtrip loader into batched loads and coroutine-based builders, with measured runs from 122 ms to ~40 ms. Walks the repo code (GitHub) and shows concrete tools: nlohmann JSON, shared_ptr-based object graphs, manual continuation-passing then replacing it with co_yield generator and promise/frame/awaiter plumbing. Delivers working examples and the infrastructure needed, not just theory.
AI-written summary · about
chapters (8)
- 0:00Introduction and motivation
- 3:33The problem: object graph
- 8:04Serial loading implementation
- 14:20Batching with continuations
- 25:55Designing the infrastructure
- 38:47Implementing C++ coroutines
- 52:38Generators and completion
- 55:27Recap and conclusion
related talks
01h 05mAutomatically Process Your Operations in Bulk With Coroutines
37mLet's Program Like It's 1999
44mMigrating a Library from RxJava To Coroutines
30mCracking the Concurrent Mode
30mAlgebraic effects, Fibers, Coroutines...Oh my!
34mParallel computing in React
34mJavaScript Concurrency and the DOM
35mAlgebraic effects, Fibers, Coroutines...Oh my!
