Avoid jvm warmup

后端 未结 4 1711
傲寒
傲寒 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:21

    This is a very big area, but here's a couple of tips:

    1) ensure your FULL test (including the iteration loop) is in a subroutine that is repeatedly invoked. So your test has the for() loop in the "parent" method. push it down to a "child" and invoke that repeatedly. This allows the various JIT technologies to really do a full optimization without having to do in-flight code replacement (dynamic loop transfer, etc..)

    2) Ensure the test runs for a long time AFTER a long warmup. 30s is bare minimum for the real measurement period, after an equally long warmup, if possible. For example, SPECjbb, etc.. run for several minutes per iteration, for multiple iterations.

提交回复
热议问题