Make dictionary lookup more efficient
snej opened this issue · 1 comments
snej commented
Currently, dictionary key lookup requires comparing the target string with each key string in turn. Since this is such a common activity in typical use, it would be good to make it faster.
One obvious improvement is to sort the dictionary keys. That makes for an easy binary search, since the dictionary's key array is random-access.
I'm trying to think of something clever involving hashing, where we define a hash algorithm as part of the spec (e.g. murmurhash3 or whatever the hash function du jour is), and the keys could be ordered as a hash table...
snej commented
I added sorting and binary search a while ago. Closing.