[Plugin] PawnPlus
#24

Quote:
Originally Posted by IllidanS4
View Post
I don't use YSI, so I haven't measured the difference, but I am interested in the results, if you decide to compare the containers. The containers and iterators use the standard C++ classes, with some minor overhead due to safety checks, so it still might be faster than some other Pawn implementation (like pawn-vector), but it depends on a lot of factors.
I'm not sure how to properly benchmark loops - I tried a few different things like empty loops with a large amount of iterations and GetTickCount before and after and the results, to my surpise, were that PawnPlus is 3 or 4 times as slow as y_iterate. Although, once again I have no clue how to benchmark loops, and I dont have the code I used yesterday so that people can check if I did it right.

Today I wanted to try something else, to see whether map_str_add_str would be faster than SetSVarString, here's the results and the code.

Code:
[19:32:44]  Bench for Store string 'Haha, this is a benchmark' in a PVar.: executes, by average, 1520.13 times/ms.
[19:32:46]  Bench for Store string 'Haha, this is a benchmark' in a normal variable with strcat.: executes, by average, 1984.01 times/ms.
[19:32:48]  Bench for Store string 'Haha, this is a benchmark' in a PawnPlus map with SA-MP string.: executes, by average, 1070.41 times/ms.
[19:32:50]  Bench for Store string 'Haha, this is a benchmark' in a PawnPlus map with PawnPlus string.: executes, by average, 620.31 times/ms.
pawn Code:
#include <a_samp>
#include <pawnplus>

#define START_BENCH(%0); {new __a=%0,__b=0,__c,__d=GetTickCount(),__e=1;do{}\
    while(__d==GetTickCount());__c=GetTickCount();__d=__c;while(__c-__d<__a||\
    __e){if(__e){if(__c-__d>=__a){__e=0;__c=GetTickCount();do{}while(__c==\
    GetTickCount());__c=GetTickCount();__d=__c;__b=0;}}{
   
#define FINISH_BENCH(%0); }__b++;__c=GetTickCount();}printf(" Bench for "\
    %0": executes, by average, %.2f times/ms.",floatdiv(__b,__a));}
   
new teststring[50],
    Map:ppteststring;

public OnFilterScriptInit()
{
    ppteststring = map_new();
    START_BENCH( 1000 );
    {
        SetSVarString("benchmark", "Haha, this is a benchmark");
    }
    FINISH_BENCH( "Store string 'Haha, this is a benchmark' in a PVar.");

    START_BENCH( 1000 );
    {
        strcat(teststring, "Haha, this is a benchmark");
    }
    FINISH_BENCH( "Store string 'Haha, this is a benchmark' in a normal variable with strcat.");

    START_BENCH( 1000 );
    {
        map_str_add_str(ppteststring, "benchmark", "Haha, this is a benchmark");
    }
    FINISH_BENCH( "Store string 'Haha, this is a benchmark' in a PawnPlus map with SA-MP string.");

    START_BENCH( 1000 );
    {
        map_str_add(ppteststring, "benchmark", str_new("Haha, this is a benchmark"));
    }
    FINISH_BENCH( "Store string 'Haha, this is a benchmark' in a PawnPlus map with PawnPlus string.");
    return 1;
}
Once again dissapointed, seems to be much slower than SA:MP alternatives, either that or I'm just shit at benchmarking, both are possible.
Reply


Messages In This Thread
PawnPlus v0.5 - by IS4 - 26.04.2018, 09:59
Re: PawnPlus - by Dice_ - 26.04.2018, 11:51
Re: PawnPlus - by Gammix - 26.04.2018, 15:55
Re: PawnPlus - by SyS - 26.04.2018, 16:24
Re: PawnPlus - by ikkentim - 26.04.2018, 16:44
Re: PawnPlus - by cuber - 26.04.2018, 17:24
Re: PawnPlus - by CaioTJF - 26.04.2018, 17:30
Re: PawnPlus - by Kaperstone - 26.04.2018, 18:58
Re: PawnPlus - by IS4 - 26.04.2018, 19:53
Re: PawnPlus - by std - 27.04.2018, 06:39
Re: PawnPlus - by Moldova - 15.07.2018, 11:40
Re: PawnPlus - by IS4 - 24.07.2018, 12:36
Re: PawnPlus - by Ivan_Ino - 24.07.2018, 15:51
Re: PawnPlus - by IS4 - 24.07.2018, 17:23
Re: PawnPlus - by Ivan_Ino - 24.07.2018, 21:24
Re: PawnPlus - by Banditul18 - 24.07.2018, 22:05
Re: PawnPlus - by IS4 - 25.07.2018, 10:24
Re: PawnPlus - by Netherland - 02.08.2018, 18:28
Re: PawnPlus - by DBZdabIt3Bro7 - 06.08.2018, 18:52
Re: PawnPlus - by IS4 - 08.08.2018, 01:39
Re: PawnPlus - by corne - 24.09.2018, 12:30
Re: PawnPlus - by Danielknow - 24.09.2018, 15:44
Re: PawnPlus - by IllidanS4 - 24.09.2018, 16:13
Re: PawnPlus - by corne - 26.09.2018, 17:48
Re: PawnPlus - by IllidanS4 - 26.09.2018, 21:02

Forum Jump:


Users browsing this thread: 1 Guest(s)