Почему время выполнения увеличивается, если итераций меньше, особенно самого первого вызова первого метода?
Код: Выделить всё
public class Main {
public static final int ITERS = 10;
public static void main(String[] args) {
test();
test();
test();
test();
test();
}
public static void test() {
double sum = 0.0;
long start = 0;
long middleStart = 0;
start = System.nanoTime();
for (int i = 0; i < ITERS; i++) {
middleStart = System.nanoTime();
sum += getIntFromNotRoundedFloat(i * 0.01f, 2);
if(i
Подробнее здесь: [url]https://stackoverflow.com/questions/78254346/strange-execution-time-performance-on-fewer-loop-iterations[/url]