When will parallel increase performance

前端 未结 5 662
你的背包
你的背包 2021-02-06 16:11

I\'m trying to understand when the usage of parallel will increase the performance.
I tested it with a simple code that ran over 100,000 items in List<

5条回答
  •  星月不相逢
    2021-02-06 16:53

    If you are iterating over a collection and doing something that is computationally intensive to each element (especially if the "something" is not also I/O intensive), then you are likely to see some benefit from parallelizing the loop. Setting a property to string.Empty is not computationally expensive, which is probably why you didn't get an improvement.

提交回复
热议问题