How to make Kotlin compile 2x faster?
summary
Aiming to halve Kotlin compile time on a huge monorepo, the team uses Gradle + Kotlin compiler tweaks: remove unused dependencies and split modules to raise parallelism, run ABI/dependency analysis, and move plugins into minimal scopes. They build and store Kotlin incremental files (cache.db, lastBuild.db) alongside bytecode in a remote cache and implement baseline cache so the server returns the closest cache plus dirty-file diffs, enabling cache to incremental resumes. Combined with class path isolation, Kotlin compile cache hits jump from ~30% to ~80–90% and average build time drops ~70%, delivering the claimed 2x speedup.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 4:01Build speed at TikTok
- 10:25Unused dependency removal
- 16:51Project structure design
- 23:18Class path isolation
- 27:14Cache and incremental
- 34:50Results and conclusion








