4 ms·
You get much better compile times if you keep scala compiler running in daemon mode (in SBT or IDEA; AFAIK Gradle can't do this yet), so it gets more benefits f
by pkolaczk 10y ago
You get much better compile times if you keep scala compiler running in daemon mode (in SBT or IDEA; AFAIK Gradle can't do this yet), so it gets more benefits from JVM HotSpot. It makes a tremendous difference (up to 10x) on larger code bases and in fact, I often get 1-5s incremental compile times on a 20 kLOC codebase. Another trick is to modularize the project and enable parallel compilation to speed up compiling everything from scratch.
As for C++ compile times, the major culprit are templates. Changing a single line of the implementation of a template requires to recompile all code using that template. Scala does not have this problem, because it has generics for most of the things that C++ templates are used, and generics support separate compilation.
- brianwawok 10y agoDaemon does help a bit. Gradle definitely has a daemon: https://docs.gradle.org/current/userguide/gradle_daemon.html https://docs.gradle.org/current/userguide/gradle_daemon.html I think in Scala you can do similar "must recompile all" if you do things like change a global implicit. > I often get 1-5s incremental compile times on a 20 kLOC codebase 20k is still toy project size though. Try incremental compile with 100k or 200k LOC. It gets bad.
- pkolaczk 10y agoGradle has a daemon, but I have some doubts if it really keeps scalac hot in memory. Last time I tried Gradle was weirdly slow with scala incremental compilation, while SBT worked like a breeze. As for compiling 200k LOC - just split it into modules with sane dependencies and then you don't have that problem. > I think in Scala you can do similar "must recompile all" if you do things like change a global implicit. But there is a world of a difference between changing a signature of an implicit than changing an implementation of a template. If you change the implementation of an implicit, the only thing that needs recompiling is the class defining the implicit, nothing more.