LINQ Queries

The performance of LINQ is a key issue for a lot of people in adopting this new tool in their arsenal. A lot of the time they are particularly interested in how LINQ to SQL performs in comparison to a traditional ADO.Net query. The news isn’t all bad. Under the covers LINQ to SQL has to use something to retrieve data, so it’s naturally going to be slower than a direct query mechanism such as ADO.Net. They key here is remembering that LINQ to SQL isn’t just a query tool. It’s an ORM solution, a rapid development tool and a more natural way to query all rolled into one.

I’m not going to go into figures just yet, since it’ll spoil my presentation but suffice to say they are quite different. Given the right tuning tips however, we can bring the LINQ to SQL query back to a competitive level. The key here is amount of reuse. There’s a great (albeit a little old) blog entry on this over @ Rico Mariani’s blog here, where he says that if you’re going to reuse your query at all you really should be compiling it. There is, as far as I’ve found no counter point to his arguments and the numbers speak for themselves. I’ve seen performance increase nearly five fold just by compiling.

If you’re keen on seeing the tests for yourself, picking up some other tips or maybe are wondering what this LINQ business is all about be sure to show up to either King O’Malleys Irish Pub in Civic @ lunch time on the 15th or that night at Microsoft Canberra and check out my “Introduction to Language Integrated Queries” presentation. Please be gentle though as it’s my first time! 🙂


4 thoughts on “LINQ Queries

  1. stephengodbold Post author

    Sure. Right in range so I can throw something heavy at you if you get smart 😛


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s