4 ms·
Scala is one of those great languages with that one Achilles heel. The speed of that compiler: $ time scalac Hello.scala real 0m2,907s user 0m7
by bjarneh 6y ago
Scala is one of those great languages with that one Achilles heel. The speed of that compiler:
$ time scalac Hello.scala
real 0m2,907s
user 0m7,901s
sys 0m0,308s
$ cat Hello.scala
object Hello{
def main(args: Array[String]){
println("hello world")
}
}
Implicit type conversion can be debated I guess, but otherwise a very beautiful language.
- lihaoyi 6y agoYeah cold compiles are slow, but most modern tools keep a hot compiler to re-use and once warm a hot compile of hello world is more like ~200ms. There's a bit of complexity managing these daemons, but that's something that the build tool normaly handles for you transparently
- bjarneh 6y agoYes it gets better, and the 'fsc' (Fast Scala Compiler) does improve on the situation somewhat; but I've always found it annoyingly slow. It should be mentioned that I haven't looked very hard at that language in many years for that very reason; so things could have improved somewhat. And from what I understand, the next version of Scala (Dotty) is going address this issue (build speed).
- _a1_ 6y agoUsing scalac is not a standard use case. Standard use case is to use sbt (well, or mill, since we're in lihaoyi's thread :D). Sbt starts up slow, but with bloop, or sbtn (native client of sbt), the compilation is really fast (much faster than C++ for example): $ time sbtc compile [info] entering *experimental* thin client - BEEP WHIRR [info] terminate the server with `shutdown` > compile [info] compiling 1 Scala source to /home/.../target/scala-2.13/classes ... [info] compile completed [success] Total time: 0 s, completed Feb 11, 2021 4:21:51 PM sbtc compile 0,08s user 0,02s system 21% cpu 0,492 total
- thinkharderdev 6y agoYeah, set 1.4 was a huge improvement. I wrote a lot of scala several years ago and just got back into it this year and the dev experience is much nicer now with the SBT sever model