|
|
|
|
|
by cogman10
236 days ago
|
|
How wasteful? Presumably 4 bytes dedicated to the keys would be dwarfed by any strings thrown into the dataset. Regardless, other than complexity, would there be any reason to not support a dynamic key size? You could dedicate the first 2 bits on the key to the length of the key. 1 byte would work if there's only 64 keys, 2 bytes would give you 16k keys and 3 4M. And if you wanted to you could use a frequency table to order the pointers such that more frequently used keys are smaller values in the dictionary. |
|