Entity Framework Performance

One of the major accomplishments of EF Beta3 was that the performance of materializing objects through Object Services (that means with Linq to Entities or with Entity SQL) was improved significantly. So significantly that  they are almost comparable with querying through EntityClient which streams data into a datareader.

I did a number of experiments that I hadn’t blogged about yet but did ask on the forums [EF: Best way to compare apples to apples when comparing perf of materialized objects vs datareader?] where I learned that ViewGeneration was the most time consuming part of the query process.

In the end, I had found this when performing the same query with LINQ to Entities, with EntityClient and with ADO.NET after separating the ViewGeneration time out in order to do fair comparisons. You can use EDMGen to pre-compile a query so that the expense of ViewGeneration becomes negligible at runtime.

  • ViewGeneration: ranges around 1110 milliseconds
  • Iterate through Materialized Objects: 14 to 15 ms
  • Iterate EDM shaped data through datareader: 17 to 18 ms
  • Iterated sqlclient datareader (classic ado.net): about 4 ms

BUT! Even better, Brian Dawson has written an extensive blog post about performance in Entity Framework: Exploring the Performance of the ADO.NET Entity Framework – Part 1. The post is filled with charts and graphs and is very enlightening. Brian even has a pie chart showing ViewGeneration as 56% of the time for performing a query.

The post digs very deeply into the query and object materialization pipeline, which, to someone like me, is dangerously close to pillow talk! 😉

And it’s only Part 1!

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.