Entity-framework – Linq To Sql vs Entity Framework Performance


I have been searching for recent performance benchmarks that compare L2S and EF and couldnt find any that tested calling stored procedures using the released version of EF. So, I ran some of my own tests and found some interesting results.

Do these results look right? Should I be testing it in a different way?

One instance of the context, one call of the sproc:
(dead link)

One instance of the context, multiple calls of the same sproc:
(dead link)

Multiple instances of the context, multiple calls of the same sproc:
(dead link)

Best Solution

I think you should test it in a somewhat different way, in order to distinguish startup costs vs. execution costs. The Entity Framework, in particular, has substantial startup costs resulting from the need to compile database views (although you can do this in advance). Likewise, LINQ has a notion of a compiled query, which would be appropriate if executing a query multiple times.

For many applications, query execution costs will be more important than startup costs. For some, the opposite may be true. Since the performance characteristics of these are different, I think it's important to distinguish them. In particular, averaging startup costs into the average cost of a query executed repeatedly is misleading.