Efficient Kotlin
summary
Kotlin tips for real savings: object headers cost about 12 bytes header so boxed Integers use 5–6x memory cost versus primitives, JVM caches small Integers and libraries like Caffeine cache avoid naive memory bloat, prefer inline functions to remove lambda-call overhead, use JVM inline/value classes to encode units without runtime wrappers, prefer sequences for large pipelines (tens of thousands of items) and array-of-primitives for dense numeric data, clear lazy initializers to prevent hidden leaks, and prefer groupingBy over groupBy to avoid many intermediate lists.
AI-written summary · about
chapters (14)
- 0:00Introduction to efficient Kotlin
- 1:07Object creation overhead
- 3:13Avoiding unnecessary objects
- 7:26Lifting heavy computations
- 9:35Inlining function calls
- 13:48Unit safety with inline classes
- 19:30Preventing memory leaks
- 23:54Efficient collection processing
- 28:35Sequences vs iterables
- 31:49Optimizing collection lookups
- 34:41Grouping vs groupBy
- 35:45Arrays for performance
- 36:26Mutable vs read-only collections
- 37:30Resources and closing








