Java编译速度vs Scala编译速度 [英] Java compile speed vs Scala compile speed

查看:334
本文介绍了Java编译速度vs Scala编译速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Scala中编程了一段时间,我喜欢它,但我厌but的一件事是编译程序所需的时间。它看起来像一个小东西,但使用Java我可以对我的程序进行小的更改,单击netbeans中的运行按钮,BOOM,它的运行,随着时间的编译似乎消耗了很多时间。我听说,对于许多大型项目,脚本语言变得非常重要,因为时间编译需要,我没有看到在我使用Java时出现的需要。

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 Java I could make small changes to my program, click the run button in netbeans, and BOOM, it's running, and over time compiling in scala seems to consume a lot of time. I hear that with many large projects a scripting language becomes very important because of the time compiling takes, a need that I didn't see arising when I was using Java.

但我来自Java,据我所知,它比任何其他编译语言更快,并且快速,因为我切换到Scala(这是一个非常简单的语言)的原因。

But I'm coming from Java which as I understand it, is faster than any other compiled language, and is fast because of the reasons I switched to Scala(It's a very simple language).

所以我想问,我可以让Scala编译更快,而且scalac可以和javac一样快。

So I wanted to ask, can I make Scala compile faster and will scalac ever be as fast as javac.

推荐答案

Scala编译器比Java更复杂,提供类型推理,隐式转换和更强大的类型系统。这些功能不是免费的,所以我不会期望scalac的速度一直像javac。这反映了在做工作的程序员和编译器做工作之间的权衡。

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.

也就是说,编译时间已经从Scala 2.7显着提高到Scala 2.8 ,我预计现在的改善继续,尘埃落定在2.8。 此页面记录了一些正在进行的工作和想法,以提高Scala编译器的性能。

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在他的回答中提供了更多细节。

Martin Odersky provides much more detail in his answer.

这篇关于Java编译速度vs Scala编译速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆