views:

414

answers:

2

I know that the JVM can do some pretty serious optimizations at runtime, especially in -server mode. Of course, it takes a little while for the JVM to settle down and reach peak performance. Is there any way to take a snapshot of those optimizations so they can be applied immediately the next time you run your app?

"Hey JVM! Great job optimizing my code. Could you write that down for me for later?"

+3  A: 

Basically not yet with Sun's VM, but they have it in mind.

See various postings/comments under here:

http://blogs.sun.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.

Rgds

Damon

PS. 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...

A: 

Perhaps this might help: http://wikis.sun.com/display/HotSpotInternals/PrintAssembly.

Bala