开发者

64-bit Java VM runs app 10x slower

I have a Java app which is packaged up using JarBundler. The app is fairly CPU intensive (lots of big Collection.sort() calls).

On Mac OS, the app runs slow and sluggish when using the 64-bit JavaApplicationStub. This JavaApplicationStub file is launching the Java 64-bit VM.

I found an old JavaApplicationStub file which is 32-bit only. I replaced it in the Bundle, and开发者_C百科 the app runs 10x faster! (consequently, the 32-bit VM is utilized when the application runs).

Does this make any sense? Why is the 64-bit VM so much slower? Does it make sense to build an app and hack the JavaApplicationStub file like this?

Advise is appreciated.


See this post on the benefits/disadvantages of running a 64bit JVM. In summary pointer dereferencing & memory de-allocation can take longer - and you are moving around larger data-structures (i.e. 64, not 32 bit, which serves you no advantage to you unless you are explicity making use of them).

Also see this relevant article, where they discuss decreases in performance of up to 85% when moving to 64bit, which is in-line with what you are experiencing:

The reason for this decrease in performance is actually very much related to the increase in memory. The memory references under the covers of Java became twice the size increasing the size of memory structures in the WAS runtime and your application's objects. Unfortunately the processor memory cache sizes didn't get larger at the same time. This means more memory cache misses, which means more busy work for the hardware dealing with the larger memory, which means worse application performance.


64 bit ain't slower. Try:

public class Benchmark {
public static void main(String args[]) {
long time = System.currentTimeMillis();
for (int a = 1; a < 900000000; a++) {
    for (int b = 1; b < 20; b++) {
    }
}
long time2 = System.currentTimeMillis() - time;
System.out.println("\nTime counter stopped: " + time2);

}

in 32 and 64 and tell us what results you get

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜