Java compile speed vs Scala compile speed

前端 未结 8 1486
陌清茗
陌清茗 2020-11-28 16:07

I\'ve been programming in Scala for a while and I like it but one thing I\'m annoyed by is the time it takes to compile programs. It\'s seems like a small thing but with Ja

8条回答
  •  隐瞒了意图╮
    2020-11-28 16:54

    The Scala compiler is more sophisticated than Java's, providing type inference, implicit conversion, and a much more powerful type system. These features don't come for free, so I wouldn't expect scalac to ever be as fast as javac. This reflects a trade-off between the programmer doing the work and the compiler doing the work.

    That said, compile times have already improved noticeably going from Scala 2.7 to Scala 2.8, and I expect the improvements to continue now that the dust has settled on 2.8. This page documents some of the ongoing efforts and ideas to improve the performance of the Scala compiler.

    Martin Odersky provides much more detail in his answer.

提交回复
热议问题