Why is ConcurrentBag so slow in .Net (4.0)? Am I doing it wrong?

后端 未结 11 600
无人及你
无人及你 2020-12-08 04:05

Before I started a project, I wrote a simple test to compare the performance of ConcurrentBag from (System.Collections.Concurrent) relative to locking & lists. I am extr

11条回答
  •  青春惊慌失措
    2020-12-08 04:46

    There seems to be a bug in the .NET Framework 4 that Microsoft fixed in 4.5, it seems they didn't expect ConcurrentBag to be used a lot.

    See the following Ayende post for more info

    http://ayende.com/blog/156097/the-high-cost-of-concurrentbag-in-net-4-0

提交回复
热议问题