Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Andrei Alexandrescu made the good point in that you should measure your code (<a href="https://www.facebook.com/notes/facebook-engineering/three-optimization-tips-for-c/10151361643253920" rel="nofollow">https://www.facebook.com/notes/facebook-engineering/three-optimization-tips-for-c/10151361643253920</a>) and this is the same advice I would give you, which is to measure your code and see what performance differences you are getting between a baseline test and your test running single threaded:</p> <ol> <li>Time required to insert data using single thread to map with above listed data </li> <li>Time required to insert data using single thread to map with above listed data and using mutex locks</li> </ol> <p>If you are still looking for a thread-safe container, you may want to look at <strong>Intel's open-source</strong> implementation of <strong>thread-safe containers</strong> at <a href="http://www.threadingbuildingblocks.org/docs/help/reference/containers_overview/concurrent_queue_cls.htm" rel="nofollow">http://www.threadingbuildingblocks.org/docs/help/reference/containers_overview/concurrent_queue_cls.htm</a> .</p> <p>Also, as a suggestion for the consumer thread implementation, you may want to read the <strong>ActiveObject</strong> article that <strong>Herb Sutter</strong> posted on his website: <a href="http://herbsutter.com/2010/07/12/effective-concurrency-prefer-using-active-objects-instead-of-naked-threads/" rel="nofollow">http://herbsutter.com/2010/07/12/effective-concurrency-prefer-using-active-objects-instead-of-naked-threads/</a></p> <p>If you can provide some more details, like why the map has to be locked all the time, we may be able to draft up a mechanism that is better performing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload