05.04.2011, 20:20
Shouldn't you re-fetch StartTick after the first code executes? If not, aren't you taking the time it takes for format AND strpack to execute (aka when the server started), which is not what you want. You want the time each section of code took to execute. I did that and got this:
Код:
format: 319 ms strpack: 137 ms
pawn Код:
#include <a_samp>
main()
{
new
StartTick,
StopTick,
string[16],
string2[16];
format(string2, 17, "I like big butts");
StartTick = GetTickCount();
for(new i; i < 1000000; i++)
{
format(string, 17, string2);
}
StopTick = GetTickCount();
printf("format: %d ms", StopTick-StartTick);
StartTick = GetTickCount();
for(new i; i < 1000000; i++)
{
strpack(string, string2, 17);
}
StopTick = GetTickCount();
printf("strpack: %d ms", StopTick-StartTick);
return 1;
}