Is there a way to tell JVM to optimize my code before processing?

Posted by Rogach on Stack Overflow See other posts from Stack Overflow or by Rogach
Published on 2011-01-07T14:18:04Z Indexed on 2011/01/07 17:53 UTC
Read the original article Hit count: 360

Filed under:
|
|

I have a method, which takes much time to execute first time. But after several invocations, it takes about 30 times less time. So, to make my application respond to user interaction faster, I "warm-up" this method (5 times) with some sample data on initialization of application. But this increases app start-up time.
I read, that JVM's can optimize and compile my java code to native, thus speeding things up. I wanted to know - maybe there is some way to explicitly tell JVM that I want this method to be compiled on startup of application?

© Stack Overflow or respective owner

Related posts about java

Related posts about optimization