Why is ++i 1ms faster than i++? What's going on in the background in memory.
Results:
i++ : 3ms
++i : 2ms
Here's the method I used to test.
int TERM = Integer.MAX_VALUE;
long startTime = System.currentTimeMillis();
for(int i = 0; i < TERM;)
{
i++;
// ++i;
}
long endTime = System.currentTimeMillis();
System.out.println(endTime - startTime);