Hi Scala Community!
Back in September 2018 we asked for your help to better understand how much time is lost by Scala developers because of compilation, and with over 600 individuals filling up the survey we have some interesting data to discuss. Thank you all for taking the time to share your experience and we hope you will find this report useful.
Scala versions
Almost 80% Scala projects are using Scala 2.12, which is the latest major Scala release available at the time the survey was published. However, there is still a relevant portion of the community that is using Scala 2.11 (over 40% according to our survey). We believe there are two reasons to explain this:
- The first release of Spark compatible with Scala 2.12 was published in September 2018. Spark is a widely used framework in Scala.
- Many library authors are cross publishing their libraries against both Scala 2.11 and Scala 2.12, exactly because many are still using Scala 2.11.
Less than 3% are using Scala 2.10.
Java runtime
The goto Java runtime is by far JDK8, with 70% using Oracle JDK8 and another 37% using Open JDK8 (assuming usage across different projects). Later versions of Java have an adoption rate between 5% and 8%.
It’s worth pointing out that Scala 2.12 requires Java 8 (or later). We can draw that the incentive to upgrade to a later version of Java is low for Scala developers.
Build tools
There is no doubt that the build tool of choice in the Scala community is sbt, which is used by over 90% of the survey’s respondents. Gradle and Maven are tied for second place, with a usage share of about 12% each. Mill comes fourth (3%), and then Bazel and Pants with less than 1%.
Compilation time
There are two aspects of compilation that we present separately: cold and incremental compilation.
Cold compilation
Cold compilation is the time it takes to compile a project’s Scala sources when starting fresh, as done by the Continuous Integration (CI) server to validate a pull request or when just starting your preferred build tool.
The survey shows that 36% of the population experience cold compilation times of over 4 minutes, with half of them waiting more than 8 minutes! The long cold compile time negatively impact developers’ productivity, as 73% of them performs at least 2 full recompiles a day.
Incremental compilation
The average incremental compilation time effectively measures the developer’s return to productivity after a code edit. Over 50% of the respondent experience incremental compile times that are longer than 30 seconds, with half of them reporting a waiting time of 1 minute or more.
55% of Scala developers execute more than 20 incremental compile a day.
Conclusions
The data collected thanks to the survey indicate that in the best case the time lost because of compilation is around 25 to 30 minutes a day. About 15-20 minutes a day are used for incremental compilation, and 10 minutes are used for full recompiles.
Whether you are on the low or high end of the compile time spectrum, Hydra reduces compilation by up 3.2 times on regular hardware. Try it out on your project and see for yourself!