SA-MP Forums Archive
[Include] HSA - Easy and fast Saving! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] HSA - Easy and fast Saving! (/showthread.php?tid=328073)

Pages: 1 2


HSA - Easy and fast Saving! - [LoD]Hauke - 23.03.2012

HSA is the probably the easiest way to store data in a file.
There is always a function for reading and for writing strings, integers and floats.
Of course, HSA has some advantages to other includes, which are provided for storing.Here is a speed comparison of HSA to SII. In this 10 times in a row 100 entries have been written single to a file and read again.
From the values ​​of the arithmetic mean was determined.
You can see, that HSA is faster. (This chart is based on writing & reading single entries)

Functions: More features does not require the system!
Files are created automatically.

Examples:
When storing data was ever so simple?
Links:


Re: HSA - Easy and fast Saving! - SpiderWalk - 23.03.2012

Hmmm Nice one!


Re: HSA - Easy and fast Saving! - [LoD]Hauke - 23.03.2012

Thanks


Re: HSA - Easy and fast Saving! - Kontrol - 23.03.2012

Epic! + Rep!


Re: HSA - Easy and fast Saving! - new121 - 23.03.2012

this is great it will make creating gang and faction files way easier.


Re: HSA - Easy and fast Saving! - AMEENAMEEN - 23.03.2012

Really nice


Re: HSA - Easy and fast Saving! - Ricop522 - 23.03.2012

Very very nice, looks so beatiful


Re: HSA - Easy and fast Saving! - kacper55331 - 23.03.2012

pawn Код:
setInt:"fraction_money"("police",81921);
setInt:"fraction_money"("firedepartment",56121);
setInt:"fraction_money"("yakuza",1912);
setInt:"fraction_money"("lufthansa",917251);

printf("Die police has %d$",getInt:"Fraktionskassen"("police"));
printf("Die fire department has %d$",getInt:"Fraktionskassen"("firedepartment"));
printf("Die yakuza has %d$",getInt:"Fraktionskassen"("yakuza"));
printf("Die lufthansa has %d$",getInt:"Fraktionskassen"("lufthansa"));
wrong translate. :/ "Fraktionskassen"

WRONG:
pawn Код:
printf("the players %s password is %s",getString:PlayerName("Passwort"));
GOOD:
pawn Код:
printf("the players %s password is %s",PlayerName, getString:PlayerName("Passwort"));



Re: HSA - Easy and fast Saving! - Kaperstone - 24.03.2012

looks very nice
thank you.


Re: HSA - Easy and fast Saving! - J.K - 24.03.2012

Nice


Re: HSA - Easy and fast Saving! - Ballu Miaa - 24.03.2012

Looks good to me. Will test with my new script! Thanks for the release (Repped+)


Re: HSA - Easy and fast Saving! - NeTuddMeg - 24.03.2012

Nice.. But I got an other result for testing.

Код:
[09:32:17]   Loading filterscript 'test.amx'...
[09:32:17] SII write started
[09:32:17] SII test done in 196

[09:32:17] HSA write started
[09:32:18] HSA test done in 391

[09:32:18] SII read started
[09:32:18] SII test done in 84

[09:32:18] this is a short string 1234567890 0.123400

[09:32:18] HSA read started
[09:32:18] HSA test done in 145

[09:32:18] this is a short string 1234567890 0.123450

[09:32:18]   Loaded 1 filterscripts.
the test script.

Код:
#include <a_samp>
#include <sii>
#include <hsa>

#define TEST_TIME   100

public OnFilterScriptInit() {
	new tick = GetTickCount();
	print("SII write started");
	for(new i = 0; i < TEST_TIME; i++) {
	    INI_Open("sii.ini");
	    INI_WriteString("string", "this is a short string");
	    INI_WriteInt("int", 1234567890);
	    INI_WriteFloat("float", 0.12345);
	    INI_Save();
	    INI_Close();
	}
	printf("SII test done in %d\n", GetTickCount() - tick);
	
	tick = GetTickCount();
	
	print("HSA write started");
	for(new i = 0; i < TEST_TIME; i++) {
		setString:"hsa"("string", "this is a short string");
	    setInt:"hsa"("int", 1234567890);
		setFloat:"hsa"("float", 0.12345);
	}
	printf("HSA test done in %d\n", GetTickCount() - tick);
	
	new rstring[256], rint, Float:rfloat;
	
	tick = GetTickCount();
	
	print("SII read started");
	for(new i = 0; i < TEST_TIME; i++) {
	    INI_Open("sii.ini");
	    INI_ReadString(rstring, "string");
	    rint = INI_ReadInt("int");
	    rfloat = INI_ReadFloat("float");
	    INI_Close();
	}
	printf("SII test done in %d\n", GetTickCount() - tick);
	printf("%s %d %f\n", rstring, rint, rfloat);
	
	rstring[0] = EOS;
	rint = 0;
	rfloat = 0.0;
	
	tick = GetTickCount();
	
	print("HSA read started");
	for(new i = 0; i < TEST_TIME; i++) {
		format(rstring, sizeof(rstring), "%s", getString:"hsa"("string"));
	    rint = getInt:"hsa"("int");
		rfloat = getFloat:"hsa"("float");
	}
	printf("HSA test done in %d\n", GetTickCount() - tick);
	printf("%s %d %f\n", rstring, rint, rfloat);
	return 1;
}



Re: HSA - Easy and fast Saving! - Shadow_ - 24.03.2012

This is really nice +rep


Re: HSA - Easy and fast Saving! - [LoD]Hauke - 24.03.2012

@kacper55331: Thanks! i translated a little bit too fast...
@All: this is a single entry writer. You should not loop saves, with more than 1,000 writings. because than SII is much faster.


Re: HSA - Easy and fast Saving! - Lorenc_ - 24.03.2012

Very neat syntax! Nice job!


Re: HSA - Easy and fast Saving! - SlashPT - 24.03.2012

Quote:
Originally Posted by [LoD]Hauke
Посмотреть сообщение
@kacper55331: Thanks! i translated a little bit too fast...
@All: this is a single entry writer. You should not loop saves, with more than 1,000 writings. because than SII is much faster.
If your tests were made with a single entry then they are a complete fail...

If you admit that SII is much faster why did you just posted wrong tests?


Re: HSA - Easy and fast Saving! - Niko_boy - 24.03.2012

Preety Nice looking Include <3 it


Re: HSA - Easy and fast Saving! - DonWade - 24.03.2012

Can You compare results with Y_Ini ?


Re: HSA - Easy and fast Saving! - NeTuddMeg - 24.03.2012

Quote:
Originally Posted by SlashPT
Посмотреть сообщение
If your tests were made with a single entry then they are a complete fail...
If you admit that SII is much faster why did you just posted wrong tests?
+1

single write.. can't beat Dini in single writes.


Re: HSA - Easy and fast Saving! - TheArcher - 24.03.2012

Quote:
Originally Posted by NeTuddMeg
Посмотреть сообщение
+1

single write.. can't beat Dini in single writes.
Who use single writes? max 1% of SA:MP scripters.