How to make a command speed test?
#1

i wanna know how to make a command speed test
i wanna make a speed test between 2 command processors

how to do it??
thanks!
Reply
#2

i believe..
https://sampwiki.blast.hk/wiki/GetTickCount
Reply
#3

i need more details like with what should i use it thanks
Reply
#4

pawn Код:
new start = GetTickCount();
YourFunction();     // Or better: a for() that runs your function a lot of times
printf("Time needed: %d", GetTickCount() - start);
Reply
#5

so if i wanna make a cmd speed test it would be like this (using zcmd)
pawn Код:
CMD:test(playerid, params[])
{
        new start = GetTickCount();
        printf("Time Needed %d", GetTickCount() - start);
        return 1;
}
right??
Reply
#6

Yes, this would possible, but be sure to have
new start = ... as the very first line, and the
printf as the very last line just before return.
The whole cmd code has to be between them. But this is not the best way, as normal commands wont take longer than a few ms, so you cant really test them like this.

The best way would be another command that runs the tested command a lot of times, so it takes longer and you can see differences more clearly:

pawn Код:
new start = GetTickCount();
for(new i = 0; i < 10000; i ++) zcmd_test(playerid, params);
printf("Time needed for 10.000 calls: %d", GetTickCount() - start);
Reply
#7

Holy Moses ... just tested it out myself, Mauzen. I mean, it`s sick, I tested 10000 commands for like a forcepayday command

ps: it`s
pawn Код:
cmd_test(playerid, params)// instead of zcmd_test(playerid, params)
Reply
#8

thanks guys i made the test i tested my command processor and zcmd and they are both the same speed yeah!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)