Another way to provide hash-type performance for Tcl data collections ===================================================================== Rev 0.11: Quicker test code Rev 0.10: Initial release The http://mini.net/tcl/2485.html page is a good spot to comment on this. This demo illustrates an experimental "ihash" command and datatype for Tcl, which uses the usual even-odd representation to store data, plus an internal integer map vector to represent the hashing layer placed on top. Even-odd lists (lists with even elements being the keys and odd elements being the values) will be called "interleaved lists" from now on ("ilists" in short), which is also which this command is called "ihash". Differences between ihash objects and arrays: * when looking up a key which is missing, an empty string is returned * unsetting non-existent keys is not an error but silently ignored * there is an "exists" option to properly test for presence of a key * ihash entries are not variables, this model does not support traces * order can be preserved, though inserts/deletes will take O(N) time * memory overhead is less than arrays (2 ints/item, plus free slots) Performance-wise, the test output seems to indicate the following: * access is similar (the difference looks like just call overhead) * creation from a list is many times faster than for arrays * full traversal takes the same amount of time for both * full traversal of the list is obviously faster for ihashes Note: set/unset performance has not been measured.