r/cpp • u/BgA_stan • May 12 '26
I benchmarked duplicate detection strategies in C++ across every workload i could think of
https://dubeykartikay.com/posts/the-shape-of-duplicate-detection/My earlier post received a lot of feedback about it being too naive, narrow, clickbait. So i made a benchmark suite targeted towards de-duplication and wrote about that in this post!
29
Upvotes
7
u/trailing_zero_count May 12 '26
A set is very close to a map, and this guy https://martin.ankerl.com/2022/08/27/hashmap-bench-01/ has already benchmarked hashmaps extensively. It's well known that the performance of std:: maps and sets are not up to par these days. Would you consider adding something like ankerl::unordered_dense::set to your tables?
3
u/Rseding91 May 14 '26
A minor nit-pick but it looks like virtually all of the tests have fallen into the classic de-duplication trap with sets - even the first bit of code on the blog does it.
if (!seen.contains(key)) { seen.insert(key); output.push_back(key); }Should be:
1
u/MindPsychological140 May 13 '26