If you know me, then you know I like to make things run fast.  I like testing performance of my software.  So with a recent website, I noticed that I query a tiny database table a lot.  There surely is a faster why to do it, and with Linq statements you can query in memory objects like Sql.  Nice…?

I was reading this post http://peterkellner.net/2009/06/03/linq-in-memory-performance/ and noticed the author was talking about almost the same thing as I was doing, so read his post, and it will tell you almost what I was thinking.

However I have a problem with his code.  I know he is just making a point, that using plain old c# will always be faster, but I think what he is saying if I read between the lines properly is that why not take the small hit in performance for nicer looking code?

Well if you read his post and agree that 0.52 seconds to run 100,000 statements like his via Linq is fine, then in my opinion you need to read about the methods with List<T>.  If you take his:

var ids = myList.Where(a => a > 5).ToList();

code and turn it into:

var ids = myList.FindAll(a => a > 5);

then you will see the almost the same performance as the plain old c#.  So why even consider Linq when you have a Generic list object.  I know his example is simple, but I wanted to make sure that if someone reads his post, then they need to be careful about “just using Linq cause it’s almost as fast” when there are other options that are even better – using FindAll was only 7 milliseconds slower!

Another slightly unrelated rant is MVP…Microsoft’s Most Valuable Professional.  I think the wording is wrong, as MVP is singular.  It should be MVP of the month, week, day, etc.  But there are a plethora of MVPs so well they can’t all be the “most valuable” surely?

Rant over.