How to make Kotlin compile 2x faster
summary
Large monorepo (≈5 million lines, ~1,000 modules, ~6,600 Android engineers, ~6k builds/day) cuts Kotlin compile time by changing concrete things: remove unused dependencies and flatten task graph, move plugin declarations into the module that needs them, split big modules and use SPI/DI to reduce upstream rebuilds, and pack Kotlin incremental intermediates into the cache as a baseline cache so cached outputs become incremental-ready. Result: Kotlin compiler cache hits rise ~30% → ~90%, average build time drops 30–70% (full build ~20min → 3–4min). class path isolation modularize and single-responsibility
AI-written summary · about
chapters (11)
- 0:00Introduction
- 2:50Build speed importance
- 4:35Beyond hardware upgrades
- 7:23Gradle cache basics
- 9:29Unused dependencies removal
- 12:20Modularizing projects
- 19:09Classpath isolation
- 27:16Custom cache packs
- 30:29Baseline cache
- 34:29Optimization summary
- 36:57Q&A
related talks
36mHow to make Kotlin compile 2x faster?
45mBuilding Kotlin Applications at Scale with Gradle
43mCompile Kotlin faster with ABI
30mHow we brought down our build times. General optimization tips
42mKotlin Adoption in the Giant Java Application
23mKotlin
35mTaming the Kotlin Compiler
27mFaster builds on Android: from 2 minutes to 2 seconds
