24.06.2016, 08:58
I do have YSI 4.
So, how would I fix this?
Do you might think it's because the dot in Pawn.CMD?
So, how would I fix this?
Do you might think it's because the dot in Pawn.CMD?
#include <a_samp>
#include <easy-mysql>
#include <YSI\y_hooks>
#include <Pawn.CMD>
Source code of the benchmark:
https://gist.github.com/urShadow/14d...17088cf2f23cbe |
Welp, thats it, the benchmarks, flagging and registering aliases convinced me to switch from Y_cmd.
Although a couple questions, do we need to use PC_Init? and whats the difference between calling a CMD and emulating it? I imagine calling it is quite faster right? Hope you keep updating this, so many great features, so much more potential. |
whats the difference between calling a CMD and emulating it? I imagine calling it is quite faster right?
|
public OnPlayerText(playerid, text[])
{
if (text[0] == '!')
{
text[0] = '/';
PC_EmulateCommand(playerid, text);
return 0;
}
return 1;
}
y_commands took 1231ms on average ZCMD took 1201ms on average I-ZCMD (non-case-sensitive) took 547ms on average I-ZCMD (case-sensitive) took 353ms on average I-ZCMD (case-sensitive) is 3.40 times faster than ZCMD I-ZCMD (case-sensitive) is 3.49 times faster than y_commands I-ZCMD (non-case-sensitive) is 2.20 times faster than ZCMD I-ZCMD (non-case-sensitive) is 2.25 times faster than y_commands ZCMD is 1.02 times faster than y_commands
Test script: (1K commands)
https://gist.github.com/urShadow/f33...dbc45ebcfd55d2 I called "/test500". Results: Pawn.CMD - 21 microseconds. i-zcmd - 154 microseconds. zcmd - 179 microseconds. |
for(int i = 0; i < 1000000; i++) { call test0 call test10 call test50 call test 100 call test 200 call test 400 //calling test 900 is same as calling test100, calling test50 is same as calling test 950 and the idea follows }
You do not understand how working my speedtest. Why do you argue? Pawn.CMD anyway faster than zcmd or izcmd.
|
OK, so now just two things before I decide to transit. Compatibility with YSI and some kind of system that we can use to loop through the commands (like in YCMD preferably). I imagine the loop to be able to iterate through specific flags too, like if I wanted to loop through admin commands I could supply the CMD_ADMIN flag.
In a system similar to YCMD that would look like this: PC_GetNextCMD(index, flags); For this or anything similar there would need to be a command indexing system, each command would need a unique ID. Another thing I'd like to see is a "bool:PC_HasFlag(cmdid, flag), "PC_GetID(name[])", and "bool:PC_IsValid(cmdid)". HasFlag would return whether or not a cmdid has a flag. GetID would be used to get the ID of a command by name, and return -1 if it doesn't exist. IsValid would return whether exists by ID. |