I am working on a Kotlin library nta.kt that provides extensions for the Java image processing library ImgLib2. Compilation time with Kotlin version 1.4.32 is 20-40 seconds on my laptop depending on gradle daemon and cache availability. For reproducible results, I compile without cache and daemon:
./gradlew --no-daemon --no-build-cache clean build publishToMavenLocal
I tried upgrading to the latest Kotlin but compilation time is extremely slow now (5+ minutes). I identified version 1.5.20 to be the first release with slow compilation time for my project. I am currently stuck and have no idea how to debug and identify potential causes for the slow compilation time myself. If there are any tools or techniques that I could use to dig into compilation in more detail, I would greatly appreciate this.
The underlying Java library makes heavy use of recursive generics that is also reflected in the extensions that I provide in nta.kt. I suspect that this might be a possible cause for the slow compilation times that I observe. ImgLib2 was slow to use in IntelliJ in the past, but I don’t know if this is related.