3 ms·
I have a lot of issues with this blog post: - Compiler, c++ library, compilation options, and platform are missing - The author doesn't benchmark vector and u
by shin_lao 8y ago
I have a lot of issues with this blog post:
- Compiler, c++ library, compilation options, and platform are missing
- The author doesn't benchmark vector and unordered_map insertions with reserve()
- If I read correctly, the author benchmarks up to 32,768 items. This is way too low. There should be tests with millions of entries.
- Random string/numbers isn't a realistic scenario and very favourable to unordered_map. I would use data from real life examples, e.g. list of cities, list of people, etc.
- Ordered arrays are missing from the benchmark (e.g. boost::container::flat_set), it's a very powerful data structure. Why just do a sorted vector at the end?
- Vector outperforms unordered_set probably because of the hashing function used.
- Jyaif 8y agoEven if they had did all that, some person on the internet would have had "a lot of issues with the post" in order to show off how smart they are. You have to draw the line somewhere, and this post is very interesting as it is.
- petermcneeley 8y agoThe original article was updated as the results were completely incorrect. The only time a linear search is faster is for a very tiny in-place integer search.
- IshKebab 8y agoNone of those things are necessary to convey the point he is trying to make.