I have a question about using a hash which has strings as keys. Let's say I have a hash which maps strings to doubles.
The questions is, I've heard some say that it is better to tokenize the strings into ints and have the hash map ints to doubles and not string to doubles? Will this generally be faster in Python or C++ (2 questions) or will it not matter. Let's say that we're using boost unsorted_map in C++ so it's ore like a Python dictionary.
Will this matter if the keys are actually (string, string) -- > double or in c++ unsorted_map>?
If you tokenize string you should be carefull not to have to different strings with same token. The std::unordered_map will also use hashes for quick search but also will take care of string with same hash but with different values. Of course it will take some time.
If you can tokenize the strings in such way that two strings would never have the same token, using map with ints as key is very good idea.
tokenizing strings to int for faster hash maps