News for hackers. Stuff that matters.
Re:Mapping Strings in C++ by utopcell on Wednesday April 12, 2017 @04:47PM (#14101591)
The performance gap between unordered_map<> and the custom implementations seems to be less than 2X. This will quickly evaporate if one uses an efficient hash such as dense_hash_map<>.
Re:Mapping Strings in C++ by rocqua on Wednesday April 12, 2017 @06:35PM (#14102365)
For the trie, things would be a lot better if the words got longer. All the 'inefficiencies' of a trie lie in the pointer chasing. The great thing is that you can process a string 'on-line'.

If things start getting really big, there are some tricks with LCP-arrays and constant time RMQ (range minimal query) that have great theoretical performance. I haven't seen that stuff in practice though.

Re:Mapping Strings in C++ by emmelaich on Wednesday April 12, 2017 @06:42PM (#14102416)
You could even do better and use a perfect hash if you have known constant list of strings.