使用“-target 1.5”生成的Java类文件的性能影响在1.6 VM上运行? [英] Performance impact of Java class files generated with "-target 1.5" running on a 1.6 VM?

查看:220
本文介绍了使用“-target 1.5”生成的Java类文件的性能影响在1.6 VM上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在几个月前将我的整个设置从Java 1.5迁移到1.6(J2EE,Tomcat)之后,我才意识到Maven仍然配置为通过Sun的javac参数-target 1.5生成针对1.5的类文件。将-target 1.5更改为-target 1.6时,我可以期待任何性能提升吗?

After migrating my whole setup from Java 1.5 to 1.6 (J2EE, Tomcat) a couple of months ago, I just realized that Maven is still configured to generate class files targeted for 1.5 via Sun's javac parameter "-target 1.5". Can I expect any performance boosts when changing "-target 1.5" to "-target 1.6"?

推荐答案

它不应该差别很大。 1.6文件可以有堆栈映射/表结构,提高字节码验证速度(Apache Harmony只使用更智能的算法)。

It shouldn't make much difference. 1.6 files can have stack map/table structures that improve bytecode verification speed (Apache Harmony just uses a smarter algorithm).

如果你要去1.4的初始加载一个类常量会稍微慢一点,但考虑到一个类加载多长时间这是无关紧要的(一个新形式的 ldc 字节码替换 Class.forName ,但结果存储在静态字段中。)

If you were to go to 1.4 the initial loading of a class constant would be slightly slower, but that's irrelevant given how long a class takes to load (a new form of the ldc bytecode replaces Class.forName, but the result was stored in a static field.)

一般来说,这无关紧要。运行时编译器是重要的位,可以生成相同的机器代码。在过去,已经对javac进行了减少优化,以便不破坏运行时编译器的代码,但这与 -target 标志无关。

In general it doesn't matter. The runtime compiler is the important bit and that can pretty much generate the same machine code. In the past there have been made to javac to reduce the optimisation it does so as not to mangle the code for the runtime compiler, but that is independent of the -target flag.

这篇关于使用“-target 1.5”生成的Java类文件的性能影响在1.6 VM上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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