为什么没有更多的Java软件本地编译? [英] Why isn't more Java software compiled natively?

查看:125
本文介绍了为什么没有更多的Java软件本地编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到字节码与原生的好处代码(可移植性)。

I realize the benefits of bytecode vs. native code (portability).

但是说你总是知道你的代码将在x86架构上运行,为什么不编译x86并获得性能优势呢?

But say you always know that your code will run on a x86 architecture, why not then compile for x86 and get the performance benefit?

请注意,我假设本机代码编译有性能提升。有些人回答说实际上可能没有任何收益对我来说是新闻..

Note that I am assuming there is a performance gain to native code compilation. Some folks have answered that there could in fact be no gain which is news to me..

推荐答案

因为性能提升(如果任何)不值得的麻烦。

Because the performance gain (if any) is not worth the trouble.

此外,垃圾回收对性能非常重要。有可能JVM的GC优于嵌入在已编译可执行文件中的GC,例如 GCJ

Also, garbage collection is very important for performance. Chances are that the GC of the JVM is better than the one embedded in the compiled executable, say with GCJ.

及时编译甚至可以带来更好的性能,因为JIT有更多的信息可用于优化编译的运行时间编译时的编译器。请参阅 JIT 上的维基百科页面。

And just in time compilation can even result in better performance because the JIT has more information are run-time available to optimize the compilation than the compiler at compile-time. See the wikipedia page on JIT.

这篇关于为什么没有更多的Java软件本地编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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