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.
Funnily enough, that engineer also disallowed Linq because it was slow. It’s been 7 years since I’ve worked with him. wonder if he ever changed his tune.
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.
Funnily enough, that engineer also disallowed Linq because it was slow. It’s been 7 years since I’ve worked with him. wonder if he ever changed his tune.