Fastest and best INI files Registration system
#1

Hello!
I need your help guys!

I'm working on optimizing my code, and I want to know what is the fastest and best INI files reader/writer, please if you know any advice to help me by posting in this topic...

Thank you in advance...
Reply
#2

DJson I think.

Search for it.
Reply
#3

Are you sure DJson is a INI files reader/writer!?
Reply
#4

Yes.

http://forum.sa-mp.com/index.php?topic=71125.0
Reply
#5

The best method is to just use the raw functions, making sure to save all variables at once.
example:
pawn Код:
stock save(playerid)
{
  new pname[24];
  GetPlayerName(playerid,pname,24);
  new File:file=fopen(pname,io_write);
  new string[128];
  format(string,128,"Score=%d\nCash=%d",GetPlayerScore(playerid,GetPlayerMoney(playerid));
  fwrite(file,string);
}
and NOT like this
pawn Код:
stock save(playerid)
{
  new pname[24];
  GetPlayerName(playerid,pname,24);
  new File:file=fopen(pname,io_write);
  new string[128];
  format(string,128,"Score=%d\n",GetPlayerScore(playerid));
  fwrite(file,string);
  format(string,128,"Cash=%d",GetPlayerMoney(playerid));
  fwrite(file,string);
}
Because the second method uses 'format' and 'fwrite' per variable, it has to run far more functions (assuming you have more than 2 variables to save)
Reply
#6

Second method isn't very efficient either.
It formats for every variable while the above code does the same for multiple variables.
Even though, you will need a big string size if you use the above listed sample, or do it in parts anyways.
If you still want to use that second method by Joe Staff, use append to write it.
Reply
#7

Which one is faster, second or DJson?

And also what do you mean "use append to write it" maij...
Reply
#8

I was implying for him to use the first method, and you don't need to use append for the second.
Reply
#9

Quote:
Originally Posted by Joe Staff
I was implying for him to use the first method, and you don't need to use append for the second.
Oh I didn't mean that..

First method = DJson
Second = your one

Which one to use, the question is...
Reply
#10

I was referring to joe's 2 listed methods. My bad for making it wuzzy.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)