C++ 02 Feb 2010 16:38:56
C++ Find Unique Elements Speed
A performance benchmark of which method is faster of finding all unique elements of a vector. The goal is having an ordered container with just the unique elements, where the tested methods are std::sort()+std::unique()+erase(), versus inserting into a separate std::set, versus inserting into std::unordered_set and then into std::set, and finally inserting into boost::unordered_set and then into std::set.
Source for the integer version is speed-find-unique-int.cpp with cycle.h.
The compilers are Microsoft Visual C++ 2010 Express as VC10 with _SECURE_SCL disabled, and GNU g++ 4.3.2.
Continue Reading »
