Avoid jvm warmup

后端 未结 4 1701
傲寒
傲寒 2020-12-06 11:43

If I am designing a test on sorting algorithm can I do this way to avoid JVM warmup ? Thank you!

double count = 0;
double start, end;
for(int r = 0; r < w         


        
4条回答
  •  不思量自难忘°
    2020-12-06 12:38

    The JVM warmup usually refers to the time it takes for the JVM to find the hotspots and JIT these sections of the code. If you run your actual tests a few hundred (actually a few thousand I believe) times you should be fairly good to go.

    You should however know that, even if you do this, there are no guarantees. You'll have to experiment with your particular JVM to figure out how much work you have to do before the vital parts is JITed and so on.


    In this little case study the JIT compilation kicked in after 1700 calls.

提交回复
热议问题