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

后端 未结 11 601
无人及你
无人及你 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:41

    It would be interesting to see scaling between the two of them.

    Two questions

    1) how fast is bag vs list for reading, remember to put a lock on the list

    2) how fast is bag vs list for reading while another thread is writing

提交回复
热议问题