LINQ To SQL Performance Getting Huge Improvement in EF5, Microsoft Does Listen!

 

The Original Problem

Back in 2009, I discovered what I considered a fatal flaw in performance using LINQ2SQL with LINQ queries.  I published 2 very popular articles on this as well as discussed it with many of my peers and Microsoft.  At the time, I was told in no uncertain terms by Microsoft that this was an inherent problem and for many reasons I did not agree with, they would not be addressing the issue.  Well, now, more than 2 years later, Microsoft has addressed this exact issue in Entity Framework Version 5 and will be providing the exact fix that is needed!

http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/

http://peterkellner.net/2009/05/06/linq-to-sql-slow-performance-compilequery-critical/

Basically, as I discussed in these articles below, without compiling queries, the amount of time it takes to compile each one causes unacceptably slow performance.  That is, if you look at my graph (copied here)

 

image

for a simple LINQ query, you can see that compiled query can be 37x faster than a non compiled, and if you read the article further, you’ll see that not compiling queries can cause the compile itself on every execution to significantly dwarf the time it takes to actually do the complete round trip including the execution to the database.

 

Microsoft Solution Coming in Entity Framework 5

I just read on the EF blog that this fix is coming.  The full article is here:

http://blogs.msdn.com/b/adonet/archive/2012/02/14/sneak-preview-entity-framework-5-0-performance-improvements.aspx

image

From these results, it seems that Microsoft will not improved LINQ2SQL, just EF but IMHO, that’s OK.  I’m moving my LINQ2SQL projects that are still in service to EF as should all of us be. 

 

Conclusions

So, even though Microsoft kept telling me I was shouting into the wind, they totally took on behind the scenes and solved this huge problem.  Thank you Microsoft!

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. Glad to see that performance improvement! Wish they would do this to LINQ2SQL though. Many of us still like LINQ2SQL and there are lots of projects out there using it. Having a free performance boost would sure be nice. Of course Microsoft wants to move us to EF so I guess this is one way to help do that.

Trackbacks

  1. [...] 3- performance Linq tosql et Entity Framework 5 : Lien [...]

Your Comments

*

Protected with IP Blacklist CloudIP Blacklist Cloud

Follow

Get every new post delivered to your Inbox

Join other followers: