There is not a 'best' loop in
. There are three kinds of loop:
, each one with it pros and cons (forget about relative performance). In my own experience, the most used is
As a general rule to achieve good performance you have to
- Design (or use an existing) good algorithm.
- Master the programming language.
Proceeding with point (2) you'll notice that 'fastest loop' questions make almost no sense.