SA-MP Forums Archive
How to make a command speed test? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make a command speed test? (/showthread.php?tid=240925)



How to make a command speed test? - AH.1990 - 16.03.2011

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!


Re: How to make a command speed test? - admantis - 16.03.2011

i believe..
https://sampwiki.blast.hk/wiki/GetTickCount


Re: How to make a command speed test? - AH.1990 - 16.03.2011

i need more details like with what should i use it thanks


Re: How to make a command speed test? - Mauzen - 16.03.2011

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



Re: How to make a command speed test? - AH.1990 - 16.03.2011

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??


Re: How to make a command speed test? - Mauzen - 17.03.2011

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);



Re: How to make a command speed test? - antonio112 - 17.03.2011

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)



Re: How to make a command speed test? - AH.1990 - 17.03.2011

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