07.02.2015, 17:58
Hey everybody.
Just wanted to make sure that my tests are correct. When I'm running this code:
I get the following results:
Am I doing something wrong or while() loop is actually 2x faster ?? :O
Just wanted to make sure that my tests are correct. When I'm running this code:
Код:
#include <a_samp>
main(){}
public OnGameModeInit( )
{
new time, i = 0,
tMax = 10000000;
time = GetTickCount( );
for( i=0; i < tMax; i++ ){}
printf( "for loop = %i ms", GetTickCount( ) - time );
time = 0, i = 0;
time = GetTickCount( );
while( i < tMax ){i++;}
printf( "while loop = %i ms", GetTickCount( ) - time );
}
Код:
[20:31:50] for loop = 648 ms [20:31:50] while loop = 355 ms

