Nested Parallel.For() loops speed and performance

后端 未结 3 1948
生来不讨喜
生来不讨喜 2020-12-19 00:08

I have a nested for loop. I have replaced the first For with a Parallel.For() and the speed of calculation increased.

My question is about replacing the

3条回答
  •  情深已故
    2020-12-19 00:27

    It again depends on many scenarios,

    1. Number of parallel threads your cpu can run.
    2. Number of iterations.

    If your CPU is a single-core processor, you will not get any benefits.

    If the number of iterations is greater, you will get some improvements.

    If there are just a few iterations, it will be slow as it involves extra overload.

提交回复
热议问题