In my Scala/SBT project, I have one file that takes up to 5(!) minutes to compile. All the other ones can compile in a few seconds. This makes development pretty painful.
I'm sure that I'm abusing some Scala constructs, but I have no idea how to go about debugging it. How does one debug long compile times in Scala?
I'm using Scala 2.9.2 and SBT 0.11.2
You can try the following Scala compiler options:
-Ystatistics
Print compiler statisticsFind a phase that takes the most time. Then, try those:
-Xprint:<phase>
Print out program after or "all"-Yshow-trees
Show detailed trees when used in connection with -print:phase-Ydebug
Output debugging messages-Ypmat-debug
Trace all pattern matcher activity.To enable these settings directly from the sbt console, you can use set scalacOptions in ThisBuild += "-Ystatistics"
, or for more than one, set scalacOptions in ThisBuild ++= Seq("-Yshow-trees", "-Ydebug")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With