Compile Kotlin faster with ABI
summary
Company converts from near zero to ~10 million Kotlin lines and finds builds slow; solution stacks practical measures: upgrade to Kotlin 1.7, switch annotation processors to KSP not KAPT, try K2 front-end which shows ~2x front-end speed wins in vendor benchmarks, enable compile-against-API with class or source-API generation to avoid recompiling dependents, split front and back end and run distributed workers/remote cache to reclaim parallelism. Implementations in Buck/Buck2 and Meta’s build tooling prove the ABI approach reduces rebuilds and boosts throughput.
AI-written summary · about
chapters (19)
- 0:00Introduction and speaker background
- 3:36Why Kotlin over Java at scale
- 5:48Build speed challenges and tradeoffs
- 7:59Types of Android builds explained
- 11:33Compiler throughput optimizations
- 14:48Classifying build optimizations
- 16:32Kotlin K2 compiler improvements
- 19:13Upgrading Kotlin compiler today
- 21:42KSP vs KAPT for annotation processors
- 22:47Parallel backend compilation
- 23:30Parallel graph execution in builds
- 26:46Remote execution and caching
- 28:58Key takeaways so far
- 29:20Using ABI to avoid unnecessary builds
- 34:24Challenges in Kotlin ABI generation
- 37:43Implementing ABI stages in builds
- 39:11Source API and dependency guessing
- 40:38Compilation avoidance techniques
- 41:45Summary and final recommendations








