Why is “while (i++ < n) {}" significantly slower than "while (++i < n) {}"

As others have pointed out, the test is flawed in many ways. You did not tell us exactly how you did this test. However, I tried to implement a “naive” test (no offense) like this: class PrePostIncrement { public static void main(String args[]) { for (int j=0; j<3; j++) { for (int i=0; i<5; i++) …

Read more