A peek past lambda

Llewellyn Falco isidore at setgame.com
Sun Aug 21 07:50:14 PDT 2011

>> http://diditwith.net/2006/10/05/PerformanceOfForeachVsListForEach.aspx
> First all the tests are flawed in this benchmark,
> a JIT can easily see that the sum is not used and discards the whole loop.

long Sum(List<int> intList)
 long result = 0;
 foreach (int i in intList)
   result += i;
 return result;

isn't the sum being returned? I hope it doesn't discard the loop.....

Llewellyn Falco

Llewellyn Falco

More information about the lambda-dev mailing list