Wednesday, November 19, 2008

Easy performance increases

Patrick has posted an interesting article on foreach performance stating that a for loop with an array is up to 5 times faster than the same code executed in a foreach on List<T> (assuming the contents is the same, just the container type is different). This wont affect most of us, however if you have a situation with nested loops this could be a significant performance improvement.

1 comment:

Lee Campbell said...

It looks like in his comments that some JIT magic makes the results slightly different on subsequent running of the code.

I wonder if using N-Gen would further affect these results. Well I dont need to wonder, I should just spike it out.