Suppose I have the following user structure:
struct User { string userId; UserType userType;
and I need to save a collection of user records (about 10 ^ 5 users, can also scale). Would it be better in performance if I store it as an unordered_set or unordered_map? Unordered_set is technically the same as a HashSet, and unordered_map is the same as HashMap, right? Using a regular set (ordered) is not an option, as inserting and deleting will be very slow when the number of elements increases.
unordered_set <User> userRecords;
OR
unordered_map <string, User> userRecords;
I need it to be very fast in terms of inserting, deleting and accessing a specific user object of its userId.
source share