- Joined
- Aug 18, 2009
- Messages
- 4,097
At some points in map coding, I face a situation where I have to assign a value to a combination of more than two struct instances.
var[red][green][donald duck][muzzel] = val
Since the default struct size is 8192=2^13, which is also the limit for arrays, I thought it could make sense to split up a hashtable to match this number. A hashtable has 2^64 slots, so four structs fit in and 2^12=4096 remain (multiplied by the 254 other possible hashtables). This excess space can be used as the attribute indicator, what should be assigned to the struct instance combination. The number is large enough to be used scope-overlapping like the key-function of vJass provides. You may also create a new table everywhere but unless you tailor them precisely, the 255 limit is quite reachable.
In general, it would be nice to know if the performance gain by splitting data on different hashtables compensates for the overhead.
var[red][green][donald duck][muzzel] = val
Since the default struct size is 8192=2^13, which is also the limit for arrays, I thought it could make sense to split up a hashtable to match this number. A hashtable has 2^64 slots, so four structs fit in and 2^12=4096 remain (multiplied by the 254 other possible hashtables). This excess space can be used as the attribute indicator, what should be assigned to the struct instance combination. The number is large enough to be used scope-overlapping like the key-function of vJass provides. You may also create a new table everywhere but unless you tailor them precisely, the 255 limit is quite reachable.
In general, it would be nice to know if the performance gain by splitting data on different hashtables compensates for the overhead.