“Nano-coroutines to the Rescue! (Using Coroutines TS, of Course)”
summary
Shows that using nano-coroutines built on Coroutines TS (MSVC and Clang implementations) turns random-memory join lookups into an interleaved prefetch pipeline: replace the memory read with an awaitable prefetch (using prefetch NTA), run many coroutines under a small throttler and symmetric coroutine-to-coroutine transfer, and recycle coroutine frames with a custom allocator. Microbenchmarks go from ~26 ns per lookup (naive) to ~10 ns handcrafted and about 3.5× speedup with coroutines using ~20 streams; profiling uses perf-stat.
AI-written summary · about
chapters (13)
- 0:00Introduction and coroutines overview
- 7:24C++ coroutines design principles
- 8:33Why databases care about coroutines
- 15:20Instruction stream interleaving concept
- 17:59State machine transformation details
- 22:45Coroutines for memory latency
- 28:58Implementing prefetch awaitable
- 33:44Symmetric coroutine-to-coroutine transfer
- 35:08Throttler implementation
- 38:21Performance results and analysis
- 43:25Nano-coroutines benefits
- 43:48Coroutines TS current status
- 45:11Q&A session
related talks
48m“Coroutines: what can't they do?”
55mPutting Coroutines to Work with the Windows Runtime
58m“C++ Coroutines - a negative overhead abstraction"
01h 05m“Concurrency, Parallelism and Coroutines”
01h 16mC++ Coroutines From Scratch
48mStructured Concurrency: Writing Safer Concurrent Code with Coroutines...
01h 30mC++ Coroutines and Structured Concurrency in Practice
47mHow to start using coroutines
