3 ms·
Offtopic: When people talk about the slow "Scala" compiler I always wonder what they actually do. I mean most of the time you are lightyears slower I thinking
by merb 11y ago
Offtopic:
When people talk about the slow "Scala" compiler I always wonder what they actually do. I mean most of the time you are lightyears slower I thinking how to solve the problem than the compiler compiles. I mean changing a file compile -> looking at the result takes on my machine mostly 1-2 seconds (incremental compilation).
Javac isn't lightyears faster and on go I would take nearly the same time, only full compilation is way way faster.
- allengeorge 11y agoWell, you're lucky. Every so often SBT loses its mind and starts throwing spurious errors. Or, runs out of memory. Solution: restart SBT, wait for a minute for it to recompile the project definition; rebuild project. That inconvenience wears on you.
- merb 11y agoActually the spurious errors didn't happen to me, however I actually use sbt tasks in intellij and deactivated every compile-server or whatever. The only thing which happens really really often is that when I coded some hours that the errors can't be displayed inside a web view and sbt loops the error, however thats not a big deal since after fixing it it goes back to normal. However my Scala project actually doesn't use too many "special" feature's I would say I actually don't use any obscure language feature, the only operator which I've written yet is a "~~" for a StringBuilder and else I actually wrote out EVERY type parameter to my function, etc. I would say we write our code so that it's readable inside all major ide's and is understandable by junior developers.
- acjohnson55 11y agoI agree. Granted, it can be easy to muck up compile times if you factor poorly, and get those cascades of "Compiling 1 file...Compiling 12 files....Compiling 100 files". But, I also do a lot of front-end web work, and Webpack takes a lot longer to rebundle my files than Scala takes to compile. I work on a Rails monolith that takes as long to start up as my Scala project does for a fresh compile. So I think the complaints are way overblown.
- jkot 11y agoIt used to be much worse, there was no incremental compilation etc... It was about 10-600x slower compared to Javac 6 years ago I got overclocked watercooled CPU just for Scalac.
- jghn 11y agoMy experience has been that most of people I know who complain about this are coming from backgrounds heavily tied to dynamic languages such as Ruby and Python. They'd likely complain about compile times regardless but as Scala is a bit slower they have more to point to
- harveywi 11y agoThe Scala compiler is excruciatingly slow for me. I frequently rely on polytypic programming techniques to prove (with a small "p") that my code is correct. The compiler simply can't keep up with me. The end result is that my state of flow is continually interrupted, or at least under assault. Bobbling my head to trance music while implicits are resolved is the only antidote that I know of.
- merb 11y agoDo you really need so many implicits? I actually learned that they will do more harm than good. I try to avoid them, where ever I can. And actually the playframework doesn't take so long to compile, to make sbt publishLocal after a clean takes no longer than 5 minutes (travis needs 40-50 minutes not sure why) for me, which is actually really fast. I mean running every tests every time takes a while, but I think that people should start incremential compilation / test if they want a fast workflow.
- gclaramunt 11y agoAlthough I agree that scala compiler is complex and can be slow, isn't your slowness expected, given you're calculating things at compile time?