Is there some reason why you don't just try them yourself? Both could actually run in zero time, since they have no side effects and could be completely optimized away.
In any case, it doesn't much matter how fast empty loops go, since you won't be using an empty loop in a program. As soon as your loop contains some code, any microscopic differences in performance will be swamped by the time taken to run the loop contents.
if you have to go with one of those two, i'd go with
simply because it's closer to the commonly used idiom
READABILITY should always be your primary concern when writing code. since 99% of all programmers would write the loop with ++, they will all understand it easier than --, especially if you're not using a 0-base offset.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
David Newton wrote:A compare to zero is typically faster than comparing to a number--but that can also be JVM/JIT/CPU-dependent.
Slight detour... but topic is interesting ...
IMHO, while I think that this statement is true, I don't think that it is the actual comparison that is faster. At the machine level, comparing a register to a number will take one cycle, regardless of whether the number is zero or not. I think it is the fact that the comparison can actually be optimized out, that makes this faster.
Typically, the generated code should be something like a comparison followed by a jump based on how the comparison set the flags. However, non-compare instructions can also set the flags -- for example, loading a zero into a register can set the zero flag. So, it is possible to just get rid of the compare, and do the jump if zero (or not zero), right after loading the value into the register.