2.02.2012

Yay for hashing

Hooray, my hash array works! It's became more complex in the end with a pools, settings about it's flexibility and so on but it works very fine right now. It's in essence a sort-of three-dimensional array with a two-dimensional helper array that'll be linked dynamically depending on how much space is needed for specific array entries. Therefore, one can define the available room with a three-dimensional vector that will control it's behaviour on entry occupation. The width is the classic hash array length - the higher, the more scattering will occur on closely numbered keys. The depth is the amount of "slots" per array entry, the number of entries with different keys that need to fit in one entry. And finally - the most interesting one - there is the height: the number of width elements long rows that will be used to lengthen a cell's slot memory. The algorithm will manage those rows in a pool and occupy/release them on demand, giving fine-grain control about the memory/speed/dynamic/static trade-off. I'll need to document it a bit more clear, but the usage is very simple if you know how to properly dimension the input arrays. However, it enable 1:1 mapping to an array of that same size that will contain the actual data (I think I mentioned that before a few times...). So for example I can just waste memory for sheer access speed or keep fine-grain control about a small number of entries (like in my multithreaded debug system for example). I'm very happy about this creation. It's like having a tool that can prove very useful in the future for a lot of tasks. I'm gonna combine it with my debug system this night and finally hope that this will solve my segmentation faults when using my old debug system. Oh man, I'm so glad that it worked out so well. 150 lines of tightly packed made me realize how comftable my macros can actually be. I only had to worry about the abstract of the code, which's very pleasing compared to completely hardcoded logic. really happy I am right now. If I can get my debug system right with this, I'm gonna be able to proudly assemble it with a few more features and go on with my application. Yes, I didn't really worked on it all the time (exams, assignments yet-to-finish, some bit of gaming to calm down), so I should be able to work on it after the exam weeks. Shouldn't be hard with such a good feeling from a successful and presentable piece of code.

Glorious days await me! Atleast in my head.

No comments: