64 位 Java 平台的优势 [英] Benefits of 64bit Java platform

查看:32
本文介绍了64 位 Java 平台的优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是java平台的绝对n00b我想知道是否需要更改代码中的任何内容才能获得 64 位 JRE 的好处?

I'm an absolute n00b into the java platform I would like to know whether I need to change anything in my code to get the benefits of 64bit JRE ?

或者是当我用java -d64"启动它时它会以某种turbo模式运行吗?

or is it something like when I initiate it with "java -d64" its gonna run in some turbo mode?

非常感谢您的帮助

推荐答案

我之前的版本虽然不是错误的,但写得很快.

My previous version, while not false, was a quickly written oversimplification.

从 32 位更改为 64 位不会自动使您的应用程序运行得更快,在某些情况下可能会导致相反的结果.在消极"方面使用 64 位指针在 JVM 中取消引用内存指针可能比使用 32 位指针需要更长的时间.16 GB 堆的完整垃圾收集和压缩可能比 2 GB 堆需要更长的时间.

Changing from 32 to 64 bits will not automatically make your application run faster, it may in some cases lead to the opposite. On the "negative" side Doing de-referencing of memory pointers in the JVM can take a longer time with 64 bit pointers than 32 bit. A full garbage collect and compaction of a 16 GB heap will likely take a longer time than with a 2 GB heap.

积极的一面:64 位处理器指令比 32 位处理器指令更有效.64 位 JVM 将允许您拥有比 32 位可获得的 4 GB 大 2^32 倍的堆大小,略小于 4 GB.(如果你能买得起那么大的内存)如果堆大小小于 4 GB,某些 JVM 可以使用压缩引用,从而为您提供 64 位指令的优势,而无需支付 64 位取消引用的代价.

On the positive side: There 64 bit processor instructions that are more effective than the 32 bit ones. 64 bit JVM will allow you to have a heap size 2^32 times bigger than the, slightly less than, 4 GB one you can get with 32 bit. (If you can afford to buy that amount of RAM) Some JVMs can work with compressed references if you have a heap size less than 4 GB, giving you the advantage of 64 bit instructions without having to pay the 64 bit de-referencing price.

如果你有一个很好的 JVM,无论堆大小我都会选择 64 位,只是准备好你可能不得不因为拥有一个非常大的堆而受到性能影响.

If you have a good JVM I would go to 64 bits no matter the heap size, just be prepared that you may have to take a performance hit for having a really big heap.

这篇关于64 位 Java 平台的优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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