Slow Scala compilation in Gradle 2.12 and later

(Jacob Ilsø) #1


I have a code base which is a mix of Scala and Java source code. I am currently using Gradle 2.11 and would like to upgrade to a more recent version.

Before upgrading I’ve done some measurements and I’ve found compilation to be much slower in Gradle 2.12 than in 2.11. A clean build takes around 3 min. in 2.11 but 4.5 min. in 2.12. Is this due to the introduction of the Zinc compiler? Has anyone had similar experiences? Any workarounds?


(Jacob Ilsø) #2

Using this in build.gradle in Gradle 2.12+ gives me performance similar to that of Gradle 2.11:

  tasks.withType(ScalaCompile) {
    scalaCompileOptions.useAnt = true

This is deprecated though, and will be removed in Gradle 3.0. Any other solutions are more than welcome.


(Daniel Forslund) #3

We just upgraded to from 2.10 to 3.0 and are also seeing a major performance drop when having switched to the Zinc compiler.

Assembling our project, which currently is a multiproject setup with about 50 subprojects, previously took about 1.5mins when running in parallel mode (about an extra minute if not run in parallel) locally on my laptop. It’s now around 7(!) mins in parallel mode and 5 without - surprisingly.

Have you - or anyone else - found any ways on how to improve it? We’re continuing to experiment and tweaking things, but if there is no major decrease in time we’ll simply have to revert the upgrade :disappointed:

Best Regards,

(Jacob Ilsø) #4

I haven’t found any ways to improve it but in the near future I plan to investigate this a bit more - maybe trying to upgrade to a more recent version of Zinc. We also see worse performance when running in parallel.

(Daniel Forslund) #5

I’ve tried the latest and greatest version available (which currently seems to be 0.3.12), but it does unfortunately not make any difference for me.

(Jacob Ilsø) #6

You might want to try out which is the successor to

(Daniel Forslund) #7

Gradle’s Scala compile-task seems to explicitly require the typesafe-version. I guess it would be possible to create a custom task or something, but I’d rather use what “natively” supported!

(Jacob Ilsø) #8

OK, thanks for trying that out. I created this bug report: Scala compilation performance decrease in Gradle 2.12+