桌面上的JVM是否使用JIT编译? [英] Do JVMs on Desktops Use JIT Compilation?

查看:105
本文介绍了桌面上的JVM是否使用JIT编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是遇到声称Java被解释的文章。我知道Oracle的HotSpot JRE提供即时编译,但对于大多数桌面用户来说情况如此吗?例如,如果我通过以下方式下载Java: http://www.java.com/en/download,这会包含一个JIT编译器吗?

I always come across articles which claim that Java is interpreted. I know that Oracle's HotSpot JRE provides just-in-time compilation, however is this the case for a majority of desktop users? For example, if I download Java via: http://www.java.com/en/download, will this include a JIT Compiler?

推荐答案

是的,绝对的。声称Java被解释的文章通常由那些不了解Java如何工作或者不理解解释意味着什么的人编写。

Yes, absolutely. Articles claiming Java is interpreted are typically written by people who either don't understand how Java works or don't understand what interpreted means.

话虽如此,HotSpot 有时会解释代码 - 这是一件好事。肯定有任何应用程序的部分(通常在启动时)只执行一次。如果你可以比JIT编译它更快地解释它,为什么还要花费开销呢?另一方面,我对Java被解释文章的体验是,不是它们的含义:)

Having said that, HotSpot will interpret code sometimes - and that's a good thing. There are definitely portions of any application (around startup, usually) which are only executed once. If you can interpret that faster than you can JIT compile it, why bother with the overhead? On the other hand, my experience of "Java is interpreted" articles is that this isn't what they mean :)

编辑:到采取TJ Crowder的观点:是的,从java.com下载的JVM将是HotSpot。但是HotSpot有两种不同的JIT - 服务器和桌面。为了总结单个句子中的差异,桌面JIT旨在快速启动应用程序,而服务器JIT则更侧重于高性能:服务器应用程序通常运行很长时间,因此花费大量时间来优化它们从长远来看,这是值得的。

To take T. J. Crowder's point in: yes, the JVM downloaded from java.com will be HotSpot. There are two different JITs for HotSpot, however - server and desktop. To sum up the differences in a single sentence, the desktop JIT is designed to start apps quickly, whereas the server JIT is more focused on high performance over time: server apps typically run for a very long time, so time spent optimising them really heavily pays off in the long run.

这篇关于桌面上的JVM是否使用JIT编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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