What isbIni is a basic, simple and efficient INI system.
Speed TestsIn testes, Bini is one of the three more fastest systems
AlgorithmBased on the theory of cache the system allocate file on variables (for quick access)
DownloadIt is in Pastebin bini.inc but, new mirrors will be accepted.
#define strcpy(%0,%1,%2) strcat((%0[0] = EOS, %0), %1, %2 + 1)
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/ |
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. |
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
#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=Thread&threadID=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;
}
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... |