this whole post is kinda confusing to me. I know barely anything about c# under the hood. the only language I've ever used in performance sensitive use cases is c++.
to me, all of the benchmark code looks like an obvious opportunity for dead store elimination. especially this loop in the second round:
for (var i = 0; i < classes.Count(); i++)
{
var x = classes.ElementAt(i).Name;
}
it doesn't look like any side effects are possible there and x is never referenced outside of the loop. can anyone ELI5 why the compiler generates any code for that snippet?
to me, all of the benchmark code looks like an obvious opportunity for dead store elimination. especially this loop in the second round:
it doesn't look like any side effects are possible there and x is never referenced outside of the loop. can anyone ELI5 why the compiler generates any code for that snippet?