Why is the JIT-compiler not working for the following code?
And every individual loop seem to take too long time
(see my other post about executing time. Speed of simple loop
public static void main (String[] args) {
for (int j = 0; j < 10; j++) {
float f;
long start = System.nanoTime();
for (int i = 0; i < 2000000000; i++) {
f = i * 0.0001F;
}
long end = System.nanoTime();
long timeToCallNanoTime = System.nanoTime() - end;
long time = Math.max(0, end - start - timeToCallNanoTime);
System.out.println("time: " + time + " ns.");
}
}
RESULT:
time: 6639317628 ns.
time: 6630196045 ns.
time: 6632583856 ns.
time: 6617596798 ns.
time: 6605243858 ns.
time: 6609097755 ns.
time: 6627151876 ns.
time: 6623427381 ns.
time: 6632506712 ns.
time: 6615870257 ns.