One thing I’ve heard a couple of times in either a trac ticket or in a forum thread is that we should all switch over to a decrement-style loop. Why? Simply because it’s faster. (We’ll ignore the time it takes to realize that you can actually loop down to zero.)
Without further ado, let’s see some results!
Now, how about Java? Because I used significantly higher numbers, I thought the averages would be better. What I found was that, quite often, the averages were the same! Now, this wasn’t always true. Sometimes the decrement would be faster by about 25-50 milliseconds faster. Java wasn’t that interesting, but its safe to say that the decrement loop is slightly faster.