you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 9 months ago (1 child)

In later .net version for loops can be slower than linq queries. If the compiler knows the iteration does not cause side effects, it often already does not allocate and can even vectorize some loops, so .Sum(...) might be faster then a manual for loop.

Optimizing without benchmarking is often wasted effort.

  • source
  • parent
  • hideshow 1 child comment