热点JIT优化和“去优化”:如何强制FASTEST? [英] Hotspot JIT optimization and "de-optimization": how to force FASTEST?

查看:222
本文介绍了热点JIT优化和“去优化”:如何强制FASTEST?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大的应用程序,我试图优化。
这样做,我通过在一个循环中运行它们数百万次,并检查它们的处理时间,对其中的小元素进行分析/基准化。



Hotspot的JIT正在进入,我实际上可以看到什么时候发生。
我喜欢它,我可以清楚地看到在热身时期之后事情进展得更快。



但是,达到最快的执行速度,在一段时间,我可以看到,然后速度减少到一个不太令人印象深刻的一个,它保持在那里。



在循环中执行的内容实际上没有改变太多,所以我几乎看不到为什么转义分析会强制代码的去优化。



基本上我得到的感觉JIT获得最好的性能,然后安定



有什么办法告诉他这还不够,我真的希望代码尽可能快地运行! 。
我知道它可以像它已经做到的。

解决方案

您应该使用 VisualVM 查找JDK附带的内存泄漏和CPU使用问题。它是相当好的分析,并有很多插件。您还可以在应用程序运行时自动从VisualVM 启动VisualVM 。 Netbeans可能有类似的东西。



我过去更喜欢JRockIt Mission Control(使用JRockIt VM),但这个



P>

I have a BIG application that I'm trying to optimize. to do so, I'm profiling / benchmarking small elements of it by running them millions of times in a loop, and checking their processing time.

obviously Hotspot's JIT is kicking in, and I can actually see when that happens. I like it, I can clearly see things going much faster after the "warm up" period.

however, after reaching the fastest execution speed and keeping it for some time, I can see that the speed is then reduced to a less impressive one, and it stays there.

what's executed in the loop does not actually change much, so I can hardly see why escape analysis would force a "de-optimization" of code.

basically I get the feeling the JIT is getting the best performance, then settles for something slower, thinking that it's "enough".

is there any way to tell him "it's not enough, I really want that code to run as fast as possible !". I know it can as it already did. Just how can I force it to do so ?

解决方案

You should use VisualVM to find memory leaks and CPU usage problems, which comes with the JDK. It's pretty good for profiling, and has many plugins. You can also start VisualVM from Eclipse automatically when an application runs. Netbeans probably has something similar. It also doesn't impact performance much, providing that you use sampling rather than profiling.

I used to prefer JRockIt Mission Control over this (with JRockIt VM), but this does the job these days.

这篇关于热点JIT优化和“去优化”:如何强制FASTEST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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