HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[SYSTEM] Presenting... The ArrayCache!

01-18-2008, 05:26 PM#1
chobibo
DELETED
01-18-2008, 06:31 PM#2
Silvenon
Not bad, though I don't have a clue how to evaluate a system.

I give you +rep for the effort.
01-18-2008, 06:32 PM#3
xombie
You say gamecache is efficient at what it does but it really isn't...
01-18-2008, 06:44 PM#4
vesuvan doppleganger
Why are flush and store sperate macros? nobody would need to flush something without storing it, and storing without flushing drastically reduces the speed.

Why would we possible need to store anything except integers? it seems a bit pointless when we could just index the unit into an array, or use a struct. I realize that is what you did in a way, but your method forces people to create tables that can only accept one type of data.

As for your storage algorithm, there are a number of things you could do. The first thing is that loops should only be used in the case of a collision, so that if the index is empty the store will be much faster.

Linear hashing, is a big no-no. It leads to uneven distribution of data on the table, which is "clustering".

edit: gamecache is efficient for using a int -> int map with string keys, but the uses this has over integer keys is not too great. JASS integer hashing could be much faster than gamecache, and not leak strings or cause bugs.
01-18-2008, 07:16 PM#5
Vexorian
gamecache is O(1) or maybe O(log n) , your ArrayCache is O(n) , in other words, gamecache is probably much faster even when you considered I2S.
01-18-2008, 07:32 PM#6
chobibo
@Vesuvian:Sorry, I misinterpreted your message, You're right, I've thought about how I stored data, It was really in-efficient, also the seek algorithm I'm using is slow, It would loop through a lot of arrays in order to find the right slot. I think I'm gonna do some research about hashig. + rep for the informative reply, and again sorry for the emotional reply I gave earlier.

@Vexorian: Thanks for the information. I knew that this was slower, there are alot of storing sytems there, namely HSAS, ABC, Coll Cool and others more, what i wanted to do is just make my own system thats all. Thanks again for the info about the efficiency.

edit: I forgot to Mention Bob666's AV_TIMERS system, it inspired me to build my own storage system.

edit2: Oh Sorry I forgot to thanks you Silvenon. Thanks for the rep :)
01-18-2008, 07:36 PM#7
Troll-Brain
Nice effort, i won't talk about the efficient but about his use.
Just want to say, that we can use constants integers for an "easier" use, like with game cache.

For example instead of do that :

Collapse JASS:
call StoreInteger(<cache>,H2I(<unit>),"xp",<value>)

Collapse JASS:
globals
   constant integer XP = 1
endglobals
....

call StoreIntegerData(H2I(<unit>),XP,<value>)
01-18-2008, 08:27 PM#8
chobibo
@Troll : I think so too. there won't be a string buildup in the code.
01-18-2008, 10:19 PM#9
Ammorth
Quote:
Originally Posted by chobibo
@Troll : I think so too. there won't be a string buildup in the code.

The string build up should be minimal if you null your variables. This allows the handles to continue returning the same number, which will return the same string when converted.
01-25-2008, 04:23 PM#11
chobibo
Yo guys, I'm back at making stupid things again LOL. can anyone review and give me feedback. Thanks
01-25-2008, 06:17 PM#12
cohadar
// I'm assuming that there wont be an instant 8191 x 3 object and/or handleId growth after storing, if there was the system will fail.
Yeah all 0x10000 crap systems assume that.

I mean how many people has to "invent" all-too-same 0x10000 modifications before someone actually decides it is time to start giving -rep for this idiotic behavior.
01-26-2008, 03:23 AM#13
chobibo
ok i'll stop LOL.