[Include] bIni V2 (easy and fast write/read ini)
#1

What is
bIni is a basic, simple and efficient INI system.



Speed Tests
In testes, Bini is one of the three more fastest systems

Like:

[.] Fini 5.0
[.] Y_INI
[.] DOF2

Algorithm
Based on the theory of cache the system allocate file on variables (for quick access)
Using a methodology cited by Double-O-Seven the system uses track number of strings (quick access after strcmp)




Download
It is in Pastebin bini.inc but, new mirrors will be accepted.

Pastebin: http://pastebin.com/AYP0Tw6Q





Authors
  • Bruno da Silva - General Developer
  • Robson da Silva - General Developer
  • Double-O-Seven - Tip of Algorithms
Reply
#2

Well thats damn fast
but why do you guys try to be the fastest? its not like theres a race in SAMP??
Reply
#3

NO credits to ******?

pawn Код:
#define strcpy(%0,%1,%2)                strcat((%0[0] = EOS, %0), %1, %2 + 1)
Reply
#4

Bruno make this function , it is soul simple.
Reply
#5

Do write and read file test by looping 1000 times.
Reply
#6

Anthony_prince
Exactly, I already know what happens, is HASH
We are looking for an efficient Hash, number
Reply
#7

I'm not gonna believe sh*t from you unless you can post the script you are using to test. And that you compared this to other INI scripts.

I could care less about how fast your script is. A player is not really gonna care about Milliseconds. I care about the functionality of a script. This has almost all of the same features as other INI scripts.

Its fine if your making this for personal use, but there are already so many other INI scripts. I want to see some different, something that is improved and better then anything before it.

So post your testing script and compare it with other INI scripts and I will be happy.
Reply
#8

So post your testing script and compare it with other INI scripts and I will be happy.

Yes, it is release version, even after we put the hash, just left to follow the development

Tips will be accepted
Reply
#9

Quote:
Originally Posted by Crimson
Посмотреть сообщение
I'm not gonna believe sh*t from you unless you can post the script you are using to test. And that you compared this to other INI scripts.

I could care less about how fast your script is. A player is not really gonna care about Milliseconds. I care about the functionality of a script. This has almost all of the same features as other INI scripts.

Its fine if your making this for personal use, but there are already so many other INI scripts. I want to see some different, something that is improved and better then anything before it.

So post your testing script and compare it with other INI scripts and I will be happy.
why are you so mad at him btw?

anyways here's my the testing script made by Double-O-Seven...thanks btw...

http://solidfiles.com/d/b50ca/
Reply
#10

Quote:
Originally Posted by SlashPT
Посмотреть сообщение
why are you so mad at him btw?

anyways here's my the testing script made by Double-O-Seven...thanks btw...

http://solidfiles.com/d/b50ca/
I'm just mad at him because he is claiming something but not showing proof.


but now seeing that script, He is right. It just really makes me angry when people claim something and can't back it up.. That is all.
Reply
#11

We are in need of a fast and effcient Numeric Hash ..

http://solidfiles.com/d/8d029/
New tests.
Reply
#12

OK, one tip:
The hash function can cause collisions. This means that two or more different keys have the same hash value.
==> You need to use strcmp to also check names AFTER comparing the hash values. This won't affect your speed generally because you will probably execute the strcmp only once.
Reply
#13

Quote:
Originally Posted by Double-O-Seven
Посмотреть сообщение
OK, one tip:
The hash function can cause collisions. This means that two or more different keys have the same hash value.
==> You need to use strcmp to also check names AFTER comparing the hash values. This won't affect your speed generally because you will probably execute the strcmp only once.
Exactly, would act as a confirmation, do not delay because it will use strcmps few (very few)..., thanks to tip Double-O-Seven.
Reply
#14

OK, you may have created the fastest INI script by providing as few features as possible.

Now the BUT-part:
BUT: It seems that it doesn't work correctly! (Values are correct until IntVar00020) ==> Hash collisions?
Код:
IntVal00000=0
IntVal00001=1
IntVal00002=2
IntVal00003=3
IntVal00004=4
IntVal00005=5
IntVal00006=6
IntVal00007=7
IntVal00008=8
IntVal00009=9
IntVal00010=10
IntVal00011=11
IntVal00012=12
IntVal00013=13
IntVal00014=14
IntVal00015=15
IntVal00016=16
IntVal00017=17
IntVal00018=18
IntVal00019=19
IntVal00020=101
IntVal00021=102
IntVal00022=103
IntVal00023=104
IntVal00024=105
IntVal00025=106
IntVal00026=107
IntVal00027=108
IntVal00028=109
IntVal00029=29
IntVal00030=111
IntVal00031=112
IntVal00032=113
IntVal00033=114
IntVal00034=115
IntVal00035=116
IntVal00036=117
IntVal00037=118
IntVal00038=119
IntVal00039=39
IntVal00040=121
IntVal00041=122
IntVal00042=123
IntVal00043=124
IntVal00044=125
IntVal00045=126
IntVal00046=46
IntVal00047=47
IntVal00048=48
IntVal00049=49
IntVal00050=50
IntVal00051=51
IntVal00052=52
IntVal00053=53
IntVal00054=54
IntVal00055=55
IntVal00056=56
IntVal00057=57
IntVal00058=58
IntVal00059=59
IntVal00060=60
IntVal00061=61
IntVal00062=62
IntVal00063=63
IntVal00064=64
IntVal00065=65
IntVal00066=66
IntVal00067=67
IntVal00068=68
IntVal00069=69
IntVal00070=70
IntVal00071=71
IntVal00072=72
IntVal00073=73
IntVal00074=74
IntVal00075=75
IntVal00076=76
IntVal00077=77
IntVal00078=78
IntVal00079=79
IntVal00080=80
IntVal00081=81
IntVal00082=82
IntVal00083=83
IntVal00084=84
IntVal00085=85
IntVal00086=86
IntVal00087=87
IntVal00088=88
IntVal00089=89
IntVal00090=90
IntVal00091=91
IntVal00092=92
IntVal00093=93
IntVal00094=94
IntVal00095=95
IntVal00096=96
IntVal00097=97
IntVal00098=98
IntVal00099=99
IntVal00100=100
IntVal00110=110
IntVal00120=120
With this script:
pawn Код:
#include <a_samp>

// Change this value and buffer sizes will change in all includes (I've modified them to take INI_CMP_BUFFER_SIZE as buffer sizes when it's defined.)
#define INI_CMP_BUFFER_SIZE         (128)

// They are very slow compared to the other scripts... might be annoying.
#define USE_DINI_AND_DJSON          true

#include <INIcmp\y_ini> // https://sampforum.blast.hk/showthread.php?tid=175565

#include <INIcmp\Double-O-Files> // https://sampforum.blast.hk/showthread.php?tid=176498

// DOF2 will take the MAX_ENTRIES definitions etc. from DOF1.
#include <INIcmp\Double-O-Files_2> // https://sampforum.blast.hk/showthread.php?tid=253715

#if USE_DINI_AND_DJSON == true

    #include <INIcmp\Dini> // https://sampforum.blast.hk/showthread.php?tid=50

    #include <INIcmp\djson> // https://sampforum.blast.hk/showthread.php?tid=48439
   
#else

    #pragma unused ret_memcpy

#endif

#include <INIcmp\mxINI> // https://sampforum.blast.hk/showthread.php?tid=111746

#include <INIcmp\Fini> // https://sampforum.blast.hk/showthread.php?tid=214660

#include <INIcmp\cini> // https://sampforum.blast.hk/showthread.php?tid=216668

#include <INIcmp\SII> // https://sampforum.blast.hk/showthread.php?tid=58458

#include <INIcmp\bIni> // https://sampforum.blast.hk/showthread.php?tid=281012

#include <INIcmp\bIni_v2> // https://sampforum.blast.hk/showthread.php?tid=281264

#include <INIcmp\SINI> // https://sampforum.blast.hk/showthread.php?tid=262795

#include <INIcmp\bfx_ini> // http://bfx-software.net/index.php?page=T...hreadID=15

//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
/*

Modifications:
- Buffer sizes are now defined with INI_CMP_BUFFER_SIZE in DOF 1 & 2, mxINI, Fini, SII, bIni, SINI and bfx_ini.
- Renamed tag INI_ in SII to SII_INI_
- Renamed tag INI_ in bIni to bIni_INI_
- static variables in Fini (because of collisions with SINI

Info:
- I can't use cini correctly here...

*/

//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ
//READ


#define MAX (INI_CMP_BUFFER_SIZE - 1)
#define WRITE_INT   i // random(1000)

public OnFilterScriptInit ()
{
    #if USE_DINI_AND_DJSON == true
        djson_GameModeInit();
    #endif
       
    file_OS();
    new k;
    new seed = GetTickCount ();
    while(k++ < 50)
    {
        printf("\nFileID=%d (%d entries)",k,MAX);
        new t,file[64],string[64];

        new
            INI:yini,
            mxini,
            val;

        print (" ");
        print(">>> Write the values <<<");

        //Double-O-Files
        t=GetTickCount();
        format(file,sizeof(file),"DOFfile%03d_%d.ini",k,seed);
        DOF_CreateFile(file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            DOF_SetInt(file,string,WRITE_INT);
        }
        DOF_SaveFile ();
        DOF_SetFile ("");
        printf("DOF SET: t=%d",GetTickCount()-t);

        //Double-O-Files 2
        t=GetTickCount();
        format(file,sizeof(file),"DOF2file%03d_%d.ini",k,seed);
        DOF2::CreateFile(file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            DOF2::SetInt(file,string,WRITE_INT);
        }
        DOF2::WriteFile ();
        DOF2::SetFile ("");
        printf("DOF2 SET: t=%d",GetTickCount()-t);

        //y_ini
        t=GetTickCount();
        format(file,sizeof(file),"YINIfile%03d_%d.ini",k,seed);
        yini = INI_Open(file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            INI_WriteInt(yini, string,WRITE_INT);
        }
        INI_Close(yini);
        printf("YINI SET: t=%d",GetTickCount()-t);

        //SII
        t=GetTickCount();
        format(file,sizeof(file),"SIIfile%03d_%d.ini",k,seed);
        SII_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            SII_INI_WriteInt(string, WRITE_INT );
        }
        SII_INI_Save ();
        SII_INI_Close ();
        printf("SII SET: t=%d",GetTickCount()-t);

        //mxINI
        t=GetTickCount();
        format(file,sizeof(file),"MXINIfile%03d_%d.ini",k,seed);
        mxini = ini_createFile (file);
        if (mxini < 0)
            mxini = ini_openFile (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            ini_setInteger (mxini, string, WRITE_INT);
        }
        ini_closeFile (mxini);
        printf("MXINI SET: t=%d",GetTickCount()-t);

        //cini
        t=GetTickCount();
        format(file,sizeof(file),"CINIfile%03d_%d.ini",k,seed);
        cini_Create (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            cini_FSave (file, "d", string, WRITE_INT);
        }
        printf("CINI SET: t=%d",GetTickCount()-t);

        //Fini
        t=GetTickCount();
        format(file,sizeof(file),"FINIfile%03d_%d.ini",k,seed);
        Fini_Create (file);
        Fini_OpenFile (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            Fini_SetVal (string, WRITE_INT);
        }
        Fini_SaveFile (file);
        Fini_CloseFile ();
        printf("FINI SET: t=%d",GetTickCount()-t);
       
        //bIni
        t=GetTickCount();
        format(file,sizeof(file),"BINIfile%03d_%d.ini",k,seed);
        bIni_INI_Create (file);
        bIni_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            bIni_INI_WriteInt (string, WRITE_INT);
        }
        bIni_INI_Save ();
        bIni_INI_Close ();
        printf("BINI SET: t=%d",GetTickCount()-t);
       
        //bIni v2
        t=GetTickCount();
        format(file,sizeof(file),"BINIV2file%03d_%d.ini",k,seed);
        bIni_v2_INI_Create (file);
        bIni_v2_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            bIni_v2_INI_WriteInt (string, WRITE_INT);
        }
        bIni_v2_INI_Save ();
        bIni_v2_INI_Close ();
        printf("BINIV2 SET: t=%d",GetTickCount()-t);
       
        //SINI
        t=GetTickCount();
        format(file,sizeof(file),"SINIfile%03d_%d.ini",k,seed);
        file_Create (file);
        file_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            file_SetVal (string, WRITE_INT);
        }
        file_Save (file);
        file_Close ();
        printf("SINI SET: t=%d",GetTickCount()-t);
       
        //bfx_ini
        t=GetTickCount();
        format(file,sizeof(file),"BFXINIfile%03d_%d.ini",k,seed);
        CreateINI (file);
        OpenINI (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            SetKeyInt (string, WRITE_INT);
        }
        SaveINI ();
        CloseINI ();
        printf("BFXINI SET: t=%d",GetTickCount()-t);

        #if USE_DINI_AND_DJSON == true

            //Dini
            t=GetTickCount();
            format(file,sizeof(file),"DINIfile%03d_%d.ini",k,seed);
            dini_Create(file);
            for(new i=0;i<MAX;i++)
            {
                format(string,sizeof(string),"IntVal%05d",i);
                dini_IntSet(file,string,WRITE_INT);
            }
            printf("DINI SET: t=%d",GetTickCount()-t);

            //DJSON
            t=GetTickCount();
            format(file,sizeof(file),"DJSONfile%03d_%d.ini",k,seed);
            djCreateFile(file);
            djAutocommit(false);
            for(new i=0;i<MAX;i++)
            {
                format(string,sizeof(string),"Test/IntVal%05d",i);
                djSetInt(file,string,WRITE_INT);
            }
            djCommit(file);
            djAutocommit(true);
            printf("DJSON SET: t=%d",GetTickCount()-t);

        #endif

        /*
            GET GET GET GET GET
        */


        print (" ");
        print(">>> Read the values <<<");

        //Double-O-Files
        t=GetTickCount();
        format(file,sizeof(file),"DOFfile%03d_%d.ini",k,seed);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            DOF_GetInt(file,string);
        }
        printf("DOF GET: t=%d",GetTickCount()-t);

        //Double-O-Files 2
        t=GetTickCount();
        format(file,sizeof(file),"DOF2file%03d_%d.ini",k,seed);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            DOF2::GetInt(file,string);
        }
        //DOF2::ParseFile (file, 0, true); // Loop or this.
        printf("DOF2 GET: t=%d",GetTickCount()-t);

        //y_ini
        t=GetTickCount();
        format(file,sizeof(file),"YINIfile%03d_%d.ini",k,seed);
        INI_ParseFile(file, string); // That's how Y_INI works? Loading everything in one function, isn't it?
        /*
        for(new i=0;i<1000;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
        }
        */

        printf("YINI GET: t=%d",GetTickCount()-t);

        t=GetTickCount();
        format(file,sizeof(file),"SIIfile%03d_%d.ini",k,seed);
        SII_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            SII_INI_ReadInt (string);
        }
        SII_INI_Save ();
        SII_INI_Close ();
        printf("SII GET: t=%d",GetTickCount()-t);

        //mxINI
        t=GetTickCount();
        format(file,sizeof(file),"MXINIfile%03d_%d.ini",k,seed);
        mxini = ini_createFile (file);
        if (mxini < 0)
            mxini = ini_openFile (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            ini_getInteger (mxini, string, val);
        }
        ini_closeFile (mxini);
        printf("MXINI GET: t=%d",GetTickCount()-t);

        //cini
        t=GetTickCount();
        format(file,sizeof(file),"CINIfile%03d_%d.ini",k,seed);
        cini_Create (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            cini_FLoad (file, "d", string, val);
        }
        printf("CINI GET: t=%d",GetTickCount()-t);

        //Fini
        t=GetTickCount();
        format(file,sizeof(file),"FINIfile%03d_%d.ini",k,seed);
        Fini_OpenFile (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            val = Fini_GetValue (string);
        }
        Fini_CloseFile ();
        printf("FINI GET: t=%d",GetTickCount()-t);
       
        //bIni
        t=GetTickCount();
        format(file,sizeof(file),"BINIfile%03d_%d.ini",k,seed);
        bIni_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            val = strval (bIni_INI_ReadString (string));
        }
        bIni_INI_Close ();
        printf("BINI GET: t=%d",GetTickCount()-t);
       
        //bIni v2
        t=GetTickCount();
        format(file,sizeof(file),"BINIV2file%03d_%d.ini",k,seed);
        bIni_v2_INI_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            val = strval (bIni_v2_INI_ReadString (string));
        }
        bIni_v2_INI_Close ();
        printf("BINIV2 GET: t=%d",GetTickCount()-t);
       
        //SINI
        t=GetTickCount();
        format(file,sizeof(file),"SINIfile%03d_%d.ini",k,seed);
        file_Open (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            val = file_GetVal (string);
        }
        file_Close ();
        printf("SINI GET: t=%d",GetTickCount()-t);
       
        //BFXINI
        t=GetTickCount();
        format(file,sizeof(file),"BFXINIfile%03d_%d.ini",k,seed);
        OpenINI (file);
        for(new i=0;i<MAX;i++)
        {
            format(string,sizeof(string),"IntVal%05d",i);
            val = ReadIntKey (string);
        }
        CloseINI ();
        printf("BFXINI GET: t=%d",GetTickCount()-t);

        #if USE_DINI_AND_DJSON == true

            //Dini
            t=GetTickCount();
            format(file,sizeof(file),"DINIfile%03d_%d.ini",k,seed);
            for(new i=0;i<MAX;i++)
            {
                format(string,sizeof(string),"IntVal%05d",i);
                dini_Int(file,string);
            }
            printf("DINI GET: t=%d",GetTickCount()-t);

            //DJSON
            t=GetTickCount();
            format(file,sizeof(file),"DJSONfile%03d_%d.ini",k,seed);
            for(new i=0;i<MAX;i++)
            {
                format(string,sizeof(string),"Test/IntVal%05d",i);
                djInt(file,string);
            }
            printf("DJSON GET: t=%d",GetTickCount()-t);
           
        #endif

        print("-=-=-=-=-=-=-=-=-=-=-=-");
        print(" ");
    }

    return 1;
}

public OnFilterScriptExit ()
{
    DOF_Exit();
    DOF2::Exit ();

    #if USE_DINI_AND_DJSON == true
        djson_GameModeExit();
    #endif
    return 1;
}
Reply
#15

Is not finalized, this bug is ending Drakins, wiat final publish
Reply
#16

Oh, you silly bunch of portuguese dudes, stop pushing the views! You got 200+ views within a view minutes while it is morning and there are only 50 people in the filterscript section?

And soon OVER 9000 within 6 hours or less!
Reply
#17

I not send views ..

Look:
http://pastebin.com/AYP0Tw6Q

Bruno da Silva fixed (we constantly test to see if the bugs)

(some jerk is sending requests views to put out my topic, stop!)
Reply
#18

I've added a speed test in INIcmp.
Looks like we've got a new winner.

Oh, and you seem to get 3-5 views per second. Refresh the filterscript mainpage. You'll see it.
Same with your OnPlayerShootPlayer. 18000 Views within a day? Oh... yes...
Reply
#19

Quote:

Oh, and you seem to get 3-5 views per second. Refresh the filterscript mainpage. You'll see it.
Same with your OnPlayerShootPlayer. 18000 Views within a day? Oh... yes...

bIni don't have a lot of functions like DOF2, but is fast . Thanks Double-O-Seven you help a lot.

Double-O-Seven, DOF2 in the second time write/read lose some speed... If you fix that DOF2 will be a better system (But, DOF2 still great)
Reply
#20

I keep it with DOF2 (y)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)