Kotlin Backstage
summary
Deep dive into Kotlin bytecode shows concrete costs and fixes: Kotlin generates extra methods and static constructors (delegates, companion objects, lambdas), boxing and intermediate collections inflate method count, and SAM/bridge methods add several methods per lambda. Practical reductions include @JvmField, @JvmStatic, careful use of Sequence versus collections, and avoiding private method references. Examples reveal that data class copy uses a bitmask and that coroutine suspend compiles to an integer state machine rather than magic. Tools: inspect bytecode with a bytecode viewer.
AI-written summary · about
chapters (12)
- 0:00Start
- 2:59Method Scoping
- 5:30Null Pointer Exceptions
- 7:07Extension Functions
- 9:29Collections
- 17:23How Can We Reduce the Method Count Even Further
- 20:34Object Destructuring
- 21:39Copy Constructor
- 24:10Statics
- 26:49Companion Object
- 28:04Fragments
- 33:13Async








