Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Yeah 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


Yes 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).


The compiler has sped up 3x in the past few years. That's a very big speedup, and the current experience is likely nothing like what you remember


Sounds good, perhaps a language that needs a revisit.


Using 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


Yeah, 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: