SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 14/11/2016, 07:17 PM   #31
14_KaPaT
Little Clucker
 
14_KaPaT's Avatar
 
Join Date: Jun 2011
Location: Ukraine
Posts: 37
Reputation: 5
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

bug frenametextfile, not removed old files
14_KaPaT is offline   Reply With Quote
Old 14/11/2016, 07:30 PM   #32
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,817
Reputation: 833
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Quote:
Originally Posted by 14_KaPaT View Post
bug frenametextfile, not removed old files
There is no such function but DINI_fcopytextfile, which makes a duplicate, you can remove the previous file for a rename.
__________________

My GitHub:

Gammix is online now   Reply With Quote
Old 15/11/2016, 01:26 PM   #33
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,320
Reputation: 3191
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Yashas already tried to explain this to you, but your speed tests are totally flawed. You cannot use them to claim that this system is faster (it might be faster, but that isn't proven). When reading and writing INI files, the slow part is the file access/parsing input/formatting output, which is the part you don't time (mostly):

pawn Code:
dini_Create("Test3.ini");
    for (new i; i < 100000; i++)
    {
        dini_Set("Test3.ini", "Set1", "Gammix_Changed");
        dini_Set("Test3.ini", "Set2", "Gammix_Changed");
        dini_Set("Test3.ini", "Set3", "Gammix_Changed");
        dini_Set("Test3.ini", "Set4", "Gammix_Changed");
        dini_Set("Test3.ini", "Set5", "Gammix_Changed");
        dini_Set("Test3.ini", "Set6", "Gammix_Changed");
        dini_Set("Test3.ini", "Set7", "Gammix_Changed");
        dini_Set("Test3.ini", "Set8", "Gammix_Changed");
        dini_Set("Test3.ini", "Set9", "Gammix_Changed");
        dini_Set("Test3.ini", "Set10", "Gammix_Changed");
    }
    dini_Timeout("Test3.ini");

This test opens a file once, does a load of trivial string manipulations a lot, then writes and closes the file once. If you really want to measure INI file writing move the open/close inside the loop:


pawn Code:
for (new i; i < 100000; i++)
    {
        dini_Create("Test3.ini");
        dini_Set("Test3.ini", "Set1", "Gammix_Changed");
        dini_Set("Test3.ini", "Set2", "Gammix_Changed");
        dini_Set("Test3.ini", "Set3", "Gammix_Changed");
        dini_Set("Test3.ini", "Set4", "Gammix_Changed");
        dini_Set("Test3.ini", "Set5", "Gammix_Changed");
        dini_Set("Test3.ini", "Set6", "Gammix_Changed");
        dini_Set("Test3.ini", "Set7", "Gammix_Changed");
        dini_Set("Test3.ini", "Set8", "Gammix_Changed");
        dini_Set("Test3.ini", "Set9", "Gammix_Changed");
        dini_Set("Test3.ini", "Set10", "Gammix_Changed");
        dini_Timeout("Test3.ini");
    }

The first test is writing a single INI file with 1,000,000 lines. The second test is more accurately testing writing a single file with 10 lines. It is the same with reading:

pawn Code:
handle = INI::OpenINI("Test2.ini", INI_READ);
    for (new i; i < 100000; i++)
    {
        INI::ReadString(handle, "", "Set1", "");
        INI::ReadString(handle, "", "Set2", "");
        INI::ReadString(handle, "", "Set3", "");
        INI::ReadString(handle, "", "Set4", "");
        INI::ReadString(handle, "", "Set5", "");
        INI::ReadString(handle, "", "Set6", "");
        INI::ReadString(handle, "", "Set7", "");
        INI::ReadString(handle, "", "Set8", "");
        INI::ReadString(handle, "", "Set9", "");
        INI::ReadString(handle, "", "Set10", "");
    }

Open the file ONCE. Parse the file ONCE. Read some easy variables a load of times. The thing you need to be timing is "INI::OpenINI". That is the slow part, and that is why y_ini's reading was so much slower:

pawn Code:
for (new i; i < 100000; i++)
    {
        INI_ParseFile("Test.ini", "LoadFile");
    }

That opens the file 100000 times, parses the file 100000 times, then doesn't actually do anything with the data. An equivalent test to that using your library would be:

pawn Code:
for (new i; i < 100000; i++)
    {
    handle = INI::OpenINI("Test2.ini", INI_READ);
    }

Your eINI code is more similar to your DINI2 code, but again because you are doing the hard part only once, any real differences get lost in the noise.

Again: I don't know if this system truly is faster because your tests don't show anything meaningful. You skip the hard work in some tests, repeat it in others, then claim that the first test was faster - of course it is!
Y_Less is offline   Reply With Quote
Old 15/11/2016, 11:35 PM   #34
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,817
Reputation: 833
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Quote:
Originally Posted by Y_Less View Post
The first test is writing a single INI file with 1,000,000 lines. The second test is more accurately testing writing a single file with 10 lines. It is the same with reading:

Open the file ONCE. Parse the file ONCE. Read some easy variables a load of times. The thing you need to be timing is "INI::OpenINI". That is the slow part, and that is why y_ini's reading was so much slower:

pawn Code:
for (new i; i < 100000; i++)
    {
        INI_ParseFile("Test.ini", "LoadFile");
    }
It makes sense to constantly parse inside the loop insteda of just one time because practically you don't open one file while updating player record etc.
I have made a new speed test above: (I am not even touching the redaing part for YINI and it slower already according to the test if it's done right)

Result:
PHP Code:
[18:20:516134 ms
[18:21:0210922 ms 
Code:
PHP Code:
#include <a_samp>
#include <dini2>
#include <YSI\y_ini>

main()
{
    new 
se;
    
    
GetTickCount();
    for (new 
i100000i++)
    {
        
dini_Get("Test1.ini""Set1");
        
dini_Int("Test1.ini""Set2");
        
dini_Float("Test1.ini""Set3");
        
dini_Timeout("Test1.ini");
    }
    
GetTickCount();
    
printf("%i ms"e-s);

    
GetTickCount();
    for (new 
i100000i++)
    {
        
INI_ParseFile("Test2.ini""LoadFile");
    }
    
GetTickCount();
    
printf("%i ms"e-s);

Quote:
Originally Posted by Y_Less View Post
Your eINI code is more similar to your DINI2 code, but again because you are doing the hard part only once, any real differences get lost in the noise.

Again: I don't know if this system truly is faster because your tests don't show anything meaningful. You skip the hard work in some tests, repeat it in others, then claim that the first test was faster - of course it is!
Here is a speed test comparing eINI and dini2/gini reading speed, similarly before, i open and close file each time inside the loop:

Result:
PHP Code:
[18:29:106182 ms
[18:29:187756 ms 
Code:
PHP Code:
#include <a_samp>
#include <dini2>
#include <eINI>

main()
{
    new 
se;
    
    
GetTickCount();
    for (new 
i100000i++)
    {
        
dini_Get("Test1.ini""Set1");
        
dini_Int("Test1.ini""Set2");
        
dini_Float("Test1.ini""Set3");
        
dini_Timeout("Test1.ini");
    }
    
GetTickCount();
    
printf("%i ms"e-s);

    
GetTickCount();
    new 
INI:handleread;
    for (new 
i100000i++)
    {
        
handle INI::OpenINI("Test1.ini"INI_READ);
        
INI::ReadString(handle"""Set1""");
        
INI::ReadInteger(handleread"Set2""");
        
INI::ReadFloat(handleFloat:read"Set3""");
        
INI::CloseINI(handle);
    }
    
GetTickCount();
    
printf("%i ms"e-s);

__________________

My GitHub:

Gammix is online now   Reply With Quote
Old 29/11/2016, 01:47 PM   #35
Vadyanga
Little Clucker
 
Join Date: Jul 2015
Location: Ru,Irk
Posts: 6
Reputation: 0
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Nice, thx.
__________________
new Nameless "pawno" #mod
Vadyanga is offline   Reply With Quote
Old 29/11/2016, 01:49 PM   #36
Vadyanga
Little Clucker
 
Join Date: Jul 2015
Location: Ru,Irk
Posts: 6
Reputation: 0
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Quote:
dini_UnSet(const file[], const field[]);
dini_IsSet(const file[], const field[]);
for what?
__________________
new Nameless "pawno" #mod

Last edited by Vadyanga; 29/11/2016 at 02:38 PM.
Vadyanga is offline   Reply With Quote
Old 02/12/2016, 01:08 PM   #37
Zorono
Huge Clucker
 
Zorono's Avatar
 
Join Date: Dec 2015
Location: Africa, Egypt, Alexandria
Posts: 353
Reputation: 30
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Nice work but i have mini proplem, 'Unfined symbol 'dini_Isset' please help
Edit: solved, sorry it was my fualt becuse on old Dini it was lowercase charecters function but on gini it was capital

Last edited by Zorono; 02/12/2016 at 03:24 PM.
Zorono is offline   Reply With Quote
Old 13/12/2016, 06:36 PM   #38
JokeyL
Banned
 
Join Date: Jul 2015
Location: Slovakia
Posts: 68
Reputation: 0
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

idk why but dini_Int and dini_Float work incorrect.
dini_Int get bad value.
JokeyL is offline   Reply With Quote
Old 14/12/2016, 02:22 PM   #39
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,817
Reputation: 833
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Quote:
Originally Posted by JokeyL View Post
idk why but dini_Int and dini_Float work incorrect.
dini_Int get bad value.
Let me see how your file looks (the .ini file screenshot). Maybe you have spaces on either sides of "=" in it or the values aren't strings!
__________________

My GitHub:

Gammix is online now   Reply With Quote
Old 14/12/2016, 06:06 PM   #40
JokeyL
Banned
 
Join Date: Jul 2015
Location: Slovakia
Posts: 68
Reputation: 0
Default Re: gini.inc - Fast multi file processor with "dini's" syntax

Nope i don't have any spaces in file.
++ if player not registered, dini_Int automatically create file with -1 values

Look at JokeyL.ini

Code:
pLogged=1
pScore=-1
pCash=-1
pKills=-1
pDeaths=-1
pVisits=-1
Example of using:

Use in OnPlayerDeath:
playerInfo[killerid][Kills] += 1;

Load:
playerInfo[playerid][Kills] = dini_Int(path, "pKills");

Save:
dini_IntSet(path, "pKills", playerInfo[playerid][Kills]);
JokeyL is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [I-ZCMD]Improved ZCMD - Fastest Command Processor Yashas Includes 99 23/07/2017 05:23 PM
[Off] Dini2? yurin Português/Portuguese 5 27/11/2016 03:09 AM
[Include] eXtended INI Processor - Fast & Feature Rich INI Processor Yashas Includes 28 01/09/2015 08:45 PM
[INC+FS] Aero File Processor by Luby * Updated! luby Filterscripts 15 14/05/2009 02:07 PM


All times are GMT. The time now is 04:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.