3 ms·
So basically none of the results are remotely relevant to real use. Except maybe that unordered_map is faster on large data sets than map. Another thing I noti
by trishume 10y ago
So basically none of the results are remotely relevant to real use. Except maybe that unordered_map is faster on large data sets than map.
Another thing I noticed is it starts with the example of a type column on a database, then proceeds to use graphs with a logarithmic scale on the x axis but not the y axis, so you can basically only see two data points, which are for millions of strings. He also only uses long strings, where I would expect the type column to be the opposite
This means even if the benchmarks were valid, I still wouldn't know what to use if I wanted to map 2-10 different short strings to numbers I wouldn't know what the right answer is. Of course the real right answer for that case, which I'd guess is a perfect hash function, wasn't tested.
- user5994461 10y agomap is a red and black tree, unordered_map is a hash table. Operations have the typical complexity of the data structure. Nothing fancy.
- trishume 10y agoExactly. I predicted every benchmark result except for the trie one, which surprised me a ton (wut??!! but pointer chasing costs!), apparently though that was just bad benchmarking putting the only path ever tested in cache.