如果我正在设计一个排序算法测试,我可以用这种方式避免JVM预热吗?谢谢!
double count = 0;
double start, end;
for(int r = 0; r < warmup; r++) {
// do test
}
for(int t = 0; t < runs; t++){
start = System.nanoTime();
// do test
end = System.nanoTime();
count += start - end;
}
double avg = count/avg