none
concurrent_unordered_map samples pack - very slow performance under debug - VS10 RRS feed

  • Question

  • Hi,

    I use concurrent_unordered_map and saw that under debug mode while adding values to the container things move very slow compared to the same scenario under release mode. To give you a measure of performance differences what it takes like 1-2 seconds in release it takes more than 5 minutes (roughly) in debug mode. std::map in debug mode is very fast also.

    Cheers.

    Wednesday, June 6, 2012 8:28 AM

Answers

  • Under _DEBUG mode every insert operation into the concurrent_unordered_map validates the internal data structure by walking every elements in the map. As a result inserts are progressively slower resulting in severe performance penalty (under _DEBUG mode).

    I have opened a bug.

    Thank you,

    --Krishnan (Microsoft)

    Thursday, June 7, 2012 12:22 AM
  • Hi raiderG,

    The bug is still under consideration. But in the eventuality of the bug not being fixed for this release I wanted to provide details on how to work around it so that you could be unblocked.

    The function _Check_range() in the header file internal_split_order_list (around line 739) is the culprit. The function performs some consistency checks under _DEBUG flag. Just comment out all the code in that function to mitigate the performance issue.

    --Krishnan (Microsoft)

    • Marked as answer by raiderG Friday, June 8, 2012 6:47 PM
    Friday, June 8, 2012 5:48 PM

All replies

  • Just wanted to make myself more clear. The insert part of concurrent_unordered_map is taking so long under debug mode only.
    Wednesday, June 6, 2012 6:34 PM
  • Under _DEBUG mode every insert operation into the concurrent_unordered_map validates the internal data structure by walking every elements in the map. As a result inserts are progressively slower resulting in severe performance penalty (under _DEBUG mode).

    I have opened a bug.

    Thank you,

    --Krishnan (Microsoft)

    Thursday, June 7, 2012 12:22 AM
  • Hi raiderG,

    The bug is still under consideration. But in the eventuality of the bug not being fixed for this release I wanted to provide details on how to work around it so that you could be unblocked.

    The function _Check_range() in the header file internal_split_order_list (around line 739) is the culprit. The function performs some consistency checks under _DEBUG flag. Just comment out all the code in that function to mitigate the performance issue.

    --Krishnan (Microsoft)

    • Marked as answer by raiderG Friday, June 8, 2012 6:47 PM
    Friday, June 8, 2012 5:48 PM
  • thanks for pointing this out Krishnan.we currently use this under vs10 so changing that file that is included with sample pack would be no problem.
    Friday, June 8, 2012 6:47 PM
  • Has the bug been fixed in VS 2012 RTM?

    -Vasile

    Wednesday, October 31, 2012 2:55 PM