| 05-03-2011, 04:24 PM | #1 |
I just started to seriously look at implementing a hashtable into my map, now realizing what it does. 2-D array? Sweeet. Now I can attach unit ids ('H000') and item ids ('I000') into the same index without hitting the 8192 index limit. Or however I say should it... As the thread question is, how much information can a hashtable hold? The hashtable I'm using needs to be able to hold a lot of data and never let it go. It will act as a database of information that I must be able to use at anytime. The table will be initialized at the start of the map and none of its value will be modified. Also, do hashtables run into any problems if it holds onto the information for too long? I'm assuming not, since this hashtable's information will always be used. EDIT: Oh. I saw Vexorian's Table library a long time ago, but was intimidated by hashtables at the time (I still don't quite understand structs sooo yeah -_-). If I plan on using hashtables, should I use Table instead? Well... looking at Table some more, I need the 2-D array structure, so I'd be getting a lot of extra function calls. Perhaps not. |
| 05-04-2011, 04:31 AM | #2 | ||
Quote:
Deaod (I think) made some calculations of how much data they can store, but it is some really really large amount that you would not run into unless you are crazy. Basically, you shouldn't worry about it. :) As for the length, I think it just follows the normal limit. Wc3 integers are 32-bit signed integers with a limit of 2147483647 (2^31 - 1). Basically, try to keep it under that number or else it might return weird values. Things like rawcodes and stuff should work fine for this. Quote:
It depends. You can use Table if you want, but it isn't always necessary. Table acts as a global hashtable system, so that when people make JASS systems, they can use that system instead of making their own hashtable. (it also adds a nicer interface for hashtables) However, the limit is 256 hashtables so you normally won't need to worry too much about creating extra hashtables. Table is a good thing to use, but you don't have to use it. It can be efficient to save hashtables, but otherwise it is pretty much the same as using normal hashtable functions. |
| 05-04-2011, 08:24 AM | #3 |
Note that Table's main functionality is to use one 2D hashtable to provide multiple 1D "arrays" without the array size limit. If you need 2D functionality, you are better off just using a native hashtable. If, however, you only need to attach data to single handle or unit IDs, creating a new hashtable would be wasteful considering the 256 limit and Table is the way to go. |
