Is while or for faster?
#1

Which one is faster or is better to use?

While
pawn Код:
new idx;
while (idx < 500)
{
   DoSomething();
   idx++;
}
For:
pawn Код:
for(new c=0;c<500;c++)
{
    DoSomething();
}
Reply
#2

In my tests ( http://pastebin.com/Hj0tJjCx ), while was slightly faster. However, the difference was 7800 ms for 'for' and 7300 ms for 'while' at 100,000,000 loops, which is but an infinitesimal difference.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)