28.05.2017, 16:48
today I learned this:
is faster then:
because the inner loop always jumps 10*100 times, but the outer loop jumps different time. top code so jumps 10+10*100 times, bottom code so jumps 100+100*10 times. the less loop should be outer loop.
PHP код:
for (new i = 0; i != 10; i++)
for (new j = 0; j != 100; j++)
Function(i, j);
PHP код:
for (new j = 0; j != 100; j++)
for (new i = 0; i != 10; i++)
Function(i, j);