- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the difference between the unordered concurrent map and the concurrent hash map? What I mean is, why would I want to chose one over the other? The documention doesnt necessarily explain the pros and cons of the two, but only explains a few differences in functionality without explaining why the differences exist. Are there speed differences in insert? the unordered container cannot saftely erase objects --great. So why would anyone use unordered concurrent map?
Also, a follow up question, is there a way to iterate over the concurrent hash map without holding locks for each element as I go? For example, I know that a certain part of my code is going to be serial and I want to iterate over the container and do some work, is there a way to skip the automatic locking?
Also, a follow up question, is there a way to iterate over the concurrent hash map without holding locks for each element as I go? For example, I know that a certain part of my code is going to be serial and I want to iterate over the container and do some work, is there a way to skip the automatic locking?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main difference is that concurrent_unordered_map provides a simpler API, more consistent with that of maps in the C++ standard library, at the cost of erase() being not a concurrent operation.
As for performance/speed differences, those might depend on a setup, and may change with future improvements.
For the follow-up question: the traversal of concurrent_hash_map is not safe if there are concurrent operations running, but you can safely use it in serial code sections. An iterator can be obtained with begin(), end(), and equal_range(key) methods.
As for performance/speed differences, those might depend on a setup, and may change with future improvements.
For the follow-up question: the traversal of concurrent_hash_map is not safe if there are concurrent operations running, but you can safely use it in serial code sections. An iterator can be obtained with begin(), end(), and equal_range(key) methods.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page