05.04.2011, 19:46
I made a quick benchmark script to see which was faster, just sharing them here for the record:
Result:
[21:40:19] format: 351 ms
[21:40:19] strpack: 524 ms
Conclusion: format is faster.
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);
for(new i; i < 1000000; i++)
{
strpack(string, string2, 17);
}
StopTick = GetTickCount();
printf("strpack: %d ms", StopTick-StartTick);
return 1;
}
[21:40:19] format: 351 ms
[21:40:19] strpack: 524 ms
Conclusion: format is faster.