mIRC Homepage
Posted By: GK_Kamel hash tables.. ini files... variables...???? - 09/01/03 09:42 PM
i have heard a lot of bashing on ini files... they seem to really suck, lol. also, variables are not a good place for anything that i would consider remotely permanent. hash tables are not good for that either... but it can be done.

what i was truely wondering is which is truely the fastest? i was building a bot, and i am now in the process of switching it all over to hash tables... because i heard they are much faster.

now, that is no problem -- i still keep all of my permanent information in ini files, but i load it into hash tables for use, so it does not bog down the script so much. then when anything is edited, it's done with the ini files as well as hash tables... etc.

i tried a script that was for calculating your PC speed. really basic scripting, but it got me thinking.

i used the original script, which used %vars, and then i made one myself for testing that used /hmake and /hdel and all that. well, the %var one went about 2x faster than the hash tables one did. but, i thought that hash tables were the fastest because they were loaded into the ram?

i dont know, but it would be nice if someone could say in which order these are as compaired to speed, as the help file really does not touch base on this.

%var, &binvar, hash tables, ini files, text files, any other method of storage i might not know about...

if someone could help me out here, i'd like to know which are truely the fastest. this information will help me to optimize the scripts i write.

tnx
Hash tables are the fastest way but only last for as long as you keep mIRC running. If you close mIRC then all hash tables are lost forever.

Variables are better when you want to store settings for your scripts. .ini files are okay but they are argueably the slowest of the lot. I'm not sure whether that is any slower than global variables though, both read from and write to a text file which is what makes them slow.
With a hash table, you can /hsave all your variables before you exit mIRC (or on a regularly schedule)...and /hload them the next time you restart mIRC. smile
Variables are stored in memory and only written to file when
- mIRC exits (temp %vars set with the -u switch are not written)
- the remote editor is opened/closed.
- /saveini is used
i get the message
"* /set: line too long (line 6, script1.ini)"
or
"* /hadd: line too long (line 9, script1.ini)"

so is there any method that can store more bytes than variables or hash tables?

i even get
"* /write: line too long (line 11, script1.ini)"

frown confused frown
© mIRC Discussion Forums