3 ms·
Every optimization can potentially have a side-effect : { time ta0 = getTime(); for (;;) { /* do something 1*/ } time ta1 = getTime
by Rexxar 17y ago
Every optimization can potentially have a side-effect :
{
time ta0 = getTime();
for (;;) { /* do something 1*/ }
time ta1 = getTime();
time tb0 = getTime();
for (;;) { /* do something 2*/ }
time tb1 = getTime();
if(ta1-ta0 < tb1-tb0)
destroy_the_world(); /* has side-effects */
}
The result depends of the speed of execution of each loops. Should optimizations really be allowed only if they don't have any side effect ?