Linq strikes again

Linq has become one of my favorite things to use. It allows you to approach the concepts of objects just as you would a sql query on a database. Linq is very flexible and i have not found an instance in when it does not work, but…….
And yes there is a big BUT, i have now found a situation where the performance suffers substantially.

The theory for me was “use linq on objects in memory and it will be even faster”, well this was not the case. I used linq on various datatables in memory and it worked but was very very slow. It seems the more i added to the where clause of the linq statement the slower it got. Since this was a program in which the performance hit was very very noticeable i had to remove all instances of linq. Since i was using a data table i went back to the dataview and the rowfilter.

The row filters performance was far superior to the linq statement.

The moral of the story is check the things you change first before you alter your code around the problem instead of getting rid of it completely. For my AI crowd its sort of like a conflict set!

This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *