Gradle task execution time: compileKotlin is way slower than compileJava?

Viewed 135

We have a multi-module Gradle project, and some of our modules have Kotlin and Java code. The compileKotlin tasks take way longer than the `compile java tasks even though most of our codebase is still Java code - is there a known performance loss to mixing Java and Kotlin source in one module?

module compile task LOC execution time
teamecho-global kotlin 155 10s
java 1.103 2s
teamecho-base kotlin 3899 16s
java 41.414 9s
teamecho-satisfaction kotlin 3.600 10s
java 6.183 3s
teamecho-dynamic-frontend kotlin 337 3s

Gradle Build Scan:

https://scans.gradle.com/s/o4avvpmrrg3oi/timeline

What surprises me the most is the 10 seconds spend on compiling the 155 LOC in the global module. In comparison to that the dynamic-frontend module only takes about 3 seconds for 330 LOC (which is still a lot!?) but is still way faster than the 155 lines from the global module. Could this be because the dynamic-frontend module has no java code?

We would like to implement more and more of our code base in Kotlin but if the Gradle build time gets so much worse, I am not sure if we should continue with it. Any tips or pin points to what we can do to decrease the time the compileKotlin task takes? We must be doing something wrong or is this performance expected?

0 Answers
Related