I've heard a lot about how JIT compilation makes code run faster than precompiled one when talking about "long-running" applications. But how long does it take to completely optimise your application?
Just for interest's sake, I'll show you example. I have some method, let's call it mySlowMethod(). It performs some matrix calculations such as rotation, multiplication and so on a few hundred times per second. I've measured a time of each call and got these results:
long time = System.nanoTime();
mySlowMethod();
System.out.println(System.nanoTime()-time);
//first call
1577187 (1.6 ms)
//next 2 seconds
~60000 (0.06 ms)
//later
less than 10000 (0.01 ms)