Java 1.4 类在 1.5 JVM 上的性能

标签 java jvm

根据发行说明,从 JVM 1.4 切换到 1.5 具有性能优势。 http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#performance

我们有在 1.5 JVM 上运行的 Java 1.4 编译类,这些类会因为使用 1.4 编译而降低性能吗?

最佳答案

其中许多功能都是“语法糖”。这意味着该语言具有新功能,但它编译为相同的字节码。所以不,你不应该在性能上受到影响。更新后的 VM 上的相同字节码。

"J2SE 5.0 is strongly compatible with previous versions of the Java 2 platform. Almost all existing programs should run on J2SE 5.0 without modification. However, there are some minor potential source and binary incompatibilities in the JRE and JDK that involve rare circumstances and "corner cases" that we are documenting here for completeness." -Sun/Oracle

http://java.sun.com/j2se/1.5.0/compatibility.html#incompatibilities

此外,根据谁编写了您的 1.4 类,他们可能对特定的 VM/gc 实现有深入的了解并为此进行了优化。不太可能,但谁知道呢。
了解某项性能的最佳方式是运行和配置文件。 “测量,不要猜测。”

关于Java 1.4 类在 1.5 JVM 上的性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2601233/

相关文章:

java - 尾递归java

java - 渐变 :compilePlayBinaryPlayRoutes is not generating all imports

java - Android:如何使用 Volley::Error 向服务器发送 header 请求

java - 如何在 Install4j 中设置变量

java - 是否可以在Java进程启动后启用调试而无需调试

Java 在 JVM 外崩溃 - 适用于 Windows 而不是 Linux

apache - 如何在 Windows 中使用单独的 JVM 配置多个 Tomcat 实例

javascript - 获取json字符串请求参数

java - 64 位 JVM 限制为 300GB 内存?

java - 将值存储为变量或再次调用方法更好吗?