[Plugin] Pawn.CMD

I do have YSI 4.

So, how would I fix this?
Do you might think it's because the dot in Pawn.CMD?
Reply

Quote:
Originally Posted by Meller
Посмотреть сообщение
I do have YSI 4.

So, how would I fix this?
Do you might think it's because the dot in Pawn.CMD?
Pawn.CMD.inc included exactly after others?
Reply

This is copied right from the gm.
PHP код:
#include <a_samp> 
#include <easy-mysql> 
#include <YSI\y_hooks> 
#include <Pawn.CMD> 
So yes.
Do you think this is the problem: http://pastebin.com/Ppnn9Xvh
I'm including the gamemode parts instead of directly in the gm.
Reply

Pawn.CMD is not compatible with YSI because YSI changes public's ids at runtime.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Pawn.CMD is not compatible with YSI because YSI changes public's ids at runtime.
Bad news, most of users on SA-MP forums is using YSI
Reply

I will try to fix the incompatibility.
Reply

Do you still have the speed test code?

I am surprised to find iZCMD being slower than ZCMD.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
You can test.
Reply

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.
Reply

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
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.
Yeah, I switched to this plugin too after the flags feature was added.

You don't need to use PC_Init at all, the include does that itself. If FILTERSCRIPT is defined, it sets it to false otherwise to true.

Both ways seem to call ProcessCommand.
Reply

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
do we need to use PC_Init?
No.
Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
whats the difference between calling a CMD and emulating it? I imagine calling it is quite faster right?
Example:
PHP код:
public OnPlayerText(playeridtext[])
{
    if (
text[0] == '!')
    {
        
text[0] = '/';
    
        
PC_EmulateCommand(playeridtext);
        
        return 
0;
    }
    
    return 
1;

Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
You can test.
iZCMD = Optimized ZCMD

If iZCMD turns out to be slower than ZCMD then there is no point of using it.

Can I have a look at your gamemode/filterscript which you used for the testing?

When I benchmarked some of the PAWN based processors last year, I got the following:
Test Script: http://pastebin.com/2KBBzcdz

Код:
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
https://github.com/YashasSamaga/I-ZC...ginal-zcmd.inc

https://github.com/YashasSamaga/I-ZC...ster/izcmd.inc

In the default non-case-sensitive mode, ZCMD is almost pretty much same as iZCMD except that iZCMD does not use format rather uses one array assignment. For obvious reasons, iZCMD has to beat ZCMD.

How many different types of commands do you fake?
Reply

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.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
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.
Don't use SendClientMessage inside the command. It invalidates the speed test.

Here is the reason.

Let's say ZCMD takes 10ms to process a command in OnPlayerCommandText and iZCMD takes 5ms to do the same.

An empty command takes 1ms to execute and a command with one SendClientMessage takes 20ms.

Now when you do the speed tests, you will find ZCMD to take 30ms and iZCMD to take 25ms. Now you obviously will say they are almost the same even though iZCMD processes commands twice as fast as ZCMD.

That is one flaw in your speed test.

Another one is all three of us (ZCMD, iZCMD, Pawn.CMD) do a binary search ultimately (CallLocalFunction does a binary search). So using test500 is not a good idea since it's the command which is in the middle in the public function table.

Try something similar to the following,
Код:
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
}
Reply

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Don't use SendClientMessage inside the command. It invalidates the speed test.
No. It does not affect my speedtest, you wrote a bullshit.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
No. It does not affect my speedtest, you wrote a bullshit.
Go through the reply again if you did not understand. I have told this 100 times to many people already. I can prove that DCMD is as fast as ZCMD if you allow me to add 100 SendClientMessage calls inside the command.

I don't know about how it affects your processor but it affects the ZCMD and iZCMD speed test for the reason I mentioned above because these processors don't stop OnPlayerCommandText until the "command finishes executing completely".

Does your speed test count the time the command takes for the speed test for PAWN.Cmd? If yes, the speed test is "unfair" for ZCMD, iZCMD, YCMD, basically every PAWN based processor because all of these use CallLocalFunction to call the public and the time the command takes to execute gets counted in the speed test.

If not, then there is no problem apart from the one I mentioned earlier. The test won't be fair for ZCMD and iZCMD.

EDIT: Maybe you called what I wrote bullshit after you tested without the SendClientMessage. You may not have noticed significant change because ZCMD/iZCMD takes awful lot of time in the command processing that the time taken by one function call becomes insignificant. However, you still need to understand that that having functions in the command is the wrong way to do the speed test.

Add 100 SendClientMessage calls in your command and you will see that YCMD/ZCMD/iZCMD all appear to be equally fast.
Reply

You do not understand how working my speedtest. Why do you argue? Pawn.CMD anyway faster than zcmd or izcmd.
Reply

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
You do not understand how working my speedtest. Why do you argue? Pawn.CMD anyway faster than zcmd or izcmd.
I seriously had no clue how your speed test even worked. I have no idea from where you have picked "0x4928A0" from where you initialize the shared pointer so I simply stopped checking it. Anyway I just went through your test sample code once again and now I see that you do the CheckTime call in test500 only which caused the confusion. Till now I was under the impression that you were counting the time taken to execute the command as well. And magically CheckTime gets called after the command execution is over. I apologize for not checking the test sample properly.

It's hard to understand anyway who ever reads your test code. There is no hint of what urmem is btw...

Of course, it is impossible for ZCMD/iZCMD to beat PAWN.Cmd for obvious reasons. PAWN.Cmd is a plugin whereas the rest are PAWN based processors.

That wasn't the point of the discussion. I was aware of that fact all the time. When I saw the disparity in the speed measured by your test in the front page, I suspected a flaw to be present in the speed test which is why I asked if I could have a look at it.
Reply

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.
Reply

Quote:
Originally Posted by Crayder
Посмотреть сообщение
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.
I will try to implement this in the next update.
Reply


Forum Jump:


Users browsing this thread: 29 Guest(s)