我知道 JVM 可以在运行时进行一些非常重要的优化,尤其是在 -server 模式下。当然,JVM 需要一段时间才能稳定下来并达到最佳性能。有什么方法可以对这些优化进行快照,以便在您下次运行应用程序时立即应用它们?
“嘿 JVM!优化我的代码做得很好。你能把它写下来给我吗?”
我知道 JVM 可以在运行时进行一些非常重要的优化,尤其是在 -server 模式下。当然,JVM 需要一段时间才能稳定下来并达到最佳性能。有什么方法可以对这些优化进行快照,以便在您下次运行应用程序时立即应用它们?
“嘿 JVM!优化我的代码做得很好。你能把它写下来给我吗?”
Basically not yet with Sun's VM, but they have it in mind.
See various postings/comments under here:
http://blogs.oracle.com/fatcatair/category/Java
(Sorry: I can't find quite the right one about retaining stats over restart for immediate C1 compilation of known-hot-at-startup methods.)
But I don't know where all this stuff is right now.
Note that optimisations appropriate in steady-state may well not be appropriate at start-up and might indeed reduce start-up performance, and indeed two runs may not have the same hotspots...