5 ms·
What I like about Kotlin is it's what you might call a "pragmatic Scala", and could find a sweet spot between Java and Scala where its added expressiveness allo
by grabcocque 10y ago
What I like about Kotlin is it's what you might call a "pragmatic Scala", and could find a sweet spot between Java and Scala where its added expressiveness allows it to shine, but Scala's complexity and performance issues aren't in evidence to scare the development managers into staying with Java.
- Scarbutt 10y agoScala's complexity and performance issues Is Kotlin really faster than Scala?
- grabcocque 10y agoScala's build times are legendarily horrible. Kotlin has similar compile times to Javac.
- pjmlp 10y agoThey are working on improving them though, specially with Dotty. In any case they aren't as bad as C++ (at least until modules arrive).
- smitherfield 10y ago> In any case they aren't as bad as C++ Speaking as a fan of Scala, I find that scalac takes a noticeable amount of time even to compile trivial Hello World-type programs. Huge C++ codebases like Chromium or Boost take ages to compile, but I seriously doubt a comparable Scala codebase would be faster.
- pjmlp 10y agoI only dabbled a few times in Scala, but I do regularly use C++ on some side projects. Do Scala compilation times get measured in hours? Just the other day I gave up compiling Cocos2D-X, after it crossed the one hour threshold on my humble dual core, 8GB.
- brianwawok 10y agoWell Scala programs only get half compiled at command time, the other half is JIT at runtime. But no not hours bad.. but say a 3 minute partial compile for a 1 line change is enough to kill your dev cycle. (Not sure it is 3 minutes bad for most projects these days, but its very hard to have a 2 second Scala compile)
- pkolaczk 10y agoYou 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.
- robertlagrant 10y agoI get what you're saying, but I wouldn't refer to that as a performance issue without any context.
- Nullabillity 10y agoIt hasn't been a big issue for me so far, but Kotlin often favours fast and compact where Scala favours generic and beautiful. For example, in Scala, nullable references are just another monad object implemented in plain Scala, while in Kotlin they have a special syntax around Java's null pointer.