[Include] [I-ZCMD]Improved ZCMD - Fastest Command Processor
#21

Just use pawn states...

[EDIT] Nvm, forget about states, here is quick and dirty version to benchmark both processors (zcmd and i-zcmd)

pawn Код:
#include <a_samp>
#include <zcmd>

#define TEST1 1000
#define TEST2 10000
#define TEST3 100000
#define COMMANDS_CALLED 5


main()
{
    print("ZCMD vs I-ZCMD Benchmark");

    TestZCMD(TEST1);
    TestIZCMD(TEST1);
    TestZCMD(TEST2);
    TestIZCMD(TEST2);
    TestZCMD(TEST3);
    TestIZCMD(TEST3);
}

forward TestZCMD(tests);
public TestZCMD(tests)
{
    new time[2]; time[0]=GetTickCount();
    for(new i = 0; i < tests; i ++)
    {
        CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/somecmd");
        CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/anothercmd someparam");
        CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/verylong command with many params");
        CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/invalidcmd");//These command does not exists (we need to handle these to...)
        CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/invalidcmd with params");//These command does not exists (we need to handle these to...)
    }
    time[1]=GetTickCount();
    printf("Benchmark of %d ZCMD commands: %d", tests * COMMANDS_CALLED, time[1] - time[0]);
}

#define OnPlayerCommandText OnPlayerCommandText2
forward OnPlayerCommandText2(playerid, cmdtext[]);
#include <izcmd>

forward TestIZCMD(tests);
public TestIZCMD(tests)
{
    new time[2]; time[0]=GetTickCount();
    for(new i = 0; i < tests; i ++)
    {
        CallLocalFunction("OnPlayerCommandText2", "is", INVALID_PLAYER_ID, "/somecmd");
        CallLocalFunction("OnPlayerCommandText2", "is", INVALID_PLAYER_ID, "/anothercmd someparam");
        CallLocalFunction("OnPlayerCommandText2", "is", INVALID_PLAYER_ID, "/verylong command with many params");
        CallLocalFunction("OnPlayerCommandText2", "is", INVALID_PLAYER_ID, "/invalidcmd");//These command does not exists (we need to handle these to...)
        CallLocalFunction("OnPlayerCommandText2", "is", INVALID_PLAYER_ID, "/invalidcmd with params");//These command does not exists (we need to handle these to...)
    }
    time[1]=GetTickCount();
    printf("Benchmark of %d i-ZCMD commands: %d", tests * COMMANDS_CALLED, time[1] - time[0]);

}

//--->>> Both processors have same syntax for commands and callbacks so we define them only once...

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    return 1;
}

CMD:somecmd(playerid, params[])
{
    return 1;
}

CMD:anothercmd(playerid, params[])
{
    return 1;
}

CMD:verylong(playerid, params[])
{
    return 1;
}
Here are results that i get (Note they are not averaged, its just a single run)
Код:
[10:08:19] ZCMD vs I-ZCMD Benchmark
[10:08:19] Benchmark of 5000 ZCMD commands: 25
[10:08:19] Benchmark of 5000 i-ZCMD commands: 16
[10:08:19] Benchmark of 50000 ZCMD commands: 248
[10:08:19] Benchmark of 50000 i-ZCMD commands: 152
[10:08:22] Benchmark of 500000 ZCMD commands: 2462
[10:08:23] Benchmark of 500000 i-ZCMD commands: 1505
Reply


Messages In This Thread
[I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 01.06.2015, 07:02
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by SickAttack - 01.06.2015, 07:19
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Manyula - 01.06.2015, 09:18
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by HydraHumza - 01.06.2015, 09:36
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by SickAttack - 01.06.2015, 14:51
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by PT - 01.06.2015, 17:26
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Pottus - 01.06.2015, 18:06
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by hamzajaved780 - 01.06.2015, 18:37
AW: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Mellnik - 01.06.2015, 19:05
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Pottus - 01.06.2015, 19:39
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by PeterJane - 06.06.2015, 11:01
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by admantis - 06.06.2015, 18:12
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Ritzy2K - 06.06.2015, 18:34
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 07.06.2015, 02:46
Respuesta: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Zume - 07.06.2015, 22:01
Re: Respuesta: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by SickAttack - 07.06.2015, 22:10
Re: Respuesta: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 08.06.2015, 15:10
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Pottus - 14.06.2015, 04:15
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by n0minal - 14.06.2015, 04:55
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 14.06.2015, 05:47
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by DRIFT_HUNTER - 14.06.2015, 05:54
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by WLSF - 14.06.2015, 10:17
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by RaeF - 14.06.2015, 10:31
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 14.06.2015, 15:06
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Crayder - 25.03.2016, 07:32
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 25.03.2016, 09:22
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Kar - 25.03.2016, 09:35
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 25.03.2016, 09:50
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Zorono - 16.06.2016, 19:52
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 06.07.2016, 13:42
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Untonyst - 14.07.2016, 07:54
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 15.07.2016, 13:36
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Arithmetic - 15.07.2016, 18:13
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 15.07.2016, 18:20
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 01.08.2016, 14:37
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Gammix - 01.08.2016, 15:35
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yashas - 02.08.2016, 07:20
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Romz - 19.10.2016, 20:18
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Yousha - 19.10.2016, 20:31
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Crayder - 20.10.2016, 04:15
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Command - 30.04.2017, 16:19
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by AbyssMorgan - 30.04.2017, 16:23
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Command - 30.04.2017, 16:49
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by feheristi97 - 23.07.2017, 16:23
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by Deken - 28.12.2018, 19:01
Re: [I-ZCMD]Improved ZCMD - Fastest Command Processor - by cuber - 28.12.2018, 20:12

Forum Jump:


Users browsing this thread: 1 Guest(s)