Microsoft Reports Significant Performance Improvements in Entity Framework 5

| by Jenni Konrad Follow 0 Followers on Feb 16, 2012. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Microsoft has announced that the upcoming Entity Framework (EF) 5 could potentially improve performance up to 67 percent over EF 4.

According to the ADO.NET team blog, the application performance improvements they've seen in this version of EF are partly due to auto-compilation of LINQ to Entities queries. The feature has always been a part of the framework, but developers had to call CompiledQuery.Compile to take advantage of it. This will now be handled automatically in EF 5: the first time a query is run, it's compiled and cached, so that successive requests can avoid the compilation step completely.

EF 4 made use of a compiled query cache for ESQL queries, and EF 5 is extending this functionality to LINQ to Entity queries. Once the cache reaches 800 compiled queries an eviction algorithm kicks in that will clean the cache periodically, once every minute. Entries are removed from the cache on a LFRU (Least frequently – recently used) basis.

Performance also improves using compiled LINQ to SQL queries. The ADO.NET team notes some changes to the way that query parameters are evaluated, which has resulted in up to 600 percent performance improvements in their internal testing.

Despite efforts to deliver .NET Framework and EF releases independent of one another, the frameworks still share some core libraries: System.Data.Entity.dll, System.Data.Entity.Design.dll, and System.Web.Entity.dll. The upside to this fact is that developers using EF 4.0 should also experience performance improvements just by upgrading to .NET Framework 4.5.

Because some of the new features in EF 5, such as Enum support and Spatial datatypes, are dependent on functionality in .NET Framework 4.5, it is not expected until after .NET 4.5 is released. Microsoft announced the availability of EF 4.3 earlier this month.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you