Coroutines Party Tricks
summary
Rapid-fire tour of ten coroutine “party tricks” that shows concrete wins and surprising costs: adding suspend to 300 functions in OKIO, 200 in MSHI turns a JSON parse from 500 MB/s to 285 MB/s and the bytecode reveals a continuation/state‑machine allocation; Retrofit uses Java dynamic proxies to pass the continuation as the last parameter; proper cancellation needs suspendCancellableCoroutine plus invokeOnCancellation and careful resume variants to close OkHttp responses; yield can avoid recursion stack overflows; sequence builders, coroutine context as linked combined maps, and an idle detector via a decorated dispatcher are demonstrated.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:03Rewriting OKIO with suspend
- 7:01Dynamic proxy Java-Kotlin
- 10:31Canceling HTTP calls safely
- 13:41Stack overflows with yield
- 17:58File system scanning with sequences
- 21:31Optimizing coroutine context
- 26:27Global uncaught exceptions
- 33:50Users as functions in navigation
- 38:02Back stack with coroutines
- 40:10Detecting idle states
- 43:40Summary








