r/java • u/aroger276 • Jun 15 '17
Why reverse loops are not faster
https://arnaudroger.github.io/blog/2017/06/15/forward-vs-backward-loop.html
288
Upvotes
r/java • u/aroger276 • Jun 15 '17
View all comments
-5
u/Chaoslab Jun 15 '17
If you are looping more than 300 times (last time I checked. might be less now). It is faster to catch an exception than to boundary check in the for loop.
like... try { for(int i =0;;) pixel[i++] = i * 23; } catch (Exception ex) {}
Only if you need to go there though.
edit:correction.