gpt4 book ai didi

java - JVM 选项 XX :UseFastEmptyMethods/XX:UseFastAccessorMethods

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:48:48 25 4
gpt4 key购买 nike

同时查看 possible JVM flags for optimizing launching startup time在我的 RCP 产品中,我发现了这些名字吸引人的 -XX:UseFastEmptyMethods-XX:UseFastAccessorMethods

这些标志似乎在 JDK-6 上可用(默认情况下打开),而在 JDK-7 上它们默认关闭。另外,我读到这种优化的权衡是它们不会增加方法调用计数器。

不使用调用计数器有什么影响?这会影响垃圾收集吗?

最佳答案

为了正确获取方法的调用次数,以便虚拟机更好地识别代码中的热点。

根据 here 的讨论

If you're on JDK6, you may need to include these two VM flags in your target Java application:
-XX:-UseFastEmptyMethods -XX:-UseFastAccessorMethods

Otherwise empty methods and accessor methods will not show up in the list, because the "fast" version doesn't increment the invocation counter for these methods. In JDK7 these two flags default to false, so you don't have to bother setting them to false explicitly.


另见:

UseFastEmptyMethods/UseFastAccessorMethods considered harmful

关于java - JVM 选项 XX :UseFastEmptyMethods/XX:UseFastAccessorMethods,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15401391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com