西西河

主题:【倡议】Java SE 5.0和.NET 2.0擂台赛 -- Highway

共:💬34 新:
全看分页树展 · 主题 跟帖
家园 你试着再加个-Xms256M,看看结果如何?

那就是我的测试结果了。

问题就出在你只限定了最大可用内存而没有限定最小可用内存上面了,缺省的设置是64M,这经常是不够的。在这样的情况下,应用程序迫使JVM多次调用GC和增加可用内存,这样会影响比较结果的。

我的测试方案是首先给足内存(至少是尽可能多的内存,以求减少调用GC和内存膨胀的次数),这样才可以比较真实地进行比较。

Unless you have problems with pauses, try granting as much memory as possible to the virtual machine. The default size (64MB) is often too small.

Setting -Xms and -Xmx to the same value increases predictability by removing the most important sizing decision from the virtual machine. On the other hand, the virtual machine can't compensate if you make a poor choice.

Be sure to increase the memory as you increase the number of processors, since allocation can be parallelized

全看分页树展 · 主题 跟帖


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河