0

Is Entity Framework faster than ado.net for Queries?

My test shows that ado.net is faster than Entity Framework in querying.Why?

podiluska
  • 50,950
  • 7
  • 98
  • 104
  • Because there is less overhead when using ADO.NET directly. It is also *a lot* more manual work to use plain ADO.NET .. –  Aug 24 '12 at 02:00
  • Possible [duplicate](http://stackoverflow.com/questions/5210476/ado-net-vs-ado-net-entity-framework) – Mark Oreta Aug 24 '12 at 02:00
  • Which have you observed is faster, in your post you state that ado is both faster and slower than EF – undefined Aug 24 '12 at 02:23
  • possible duplicate of [Entity framework and linq to entity performance](http://stackoverflow.com/questions/12029385/entity-framework-and-linq-to-entity-performance) – Gert Arnold Aug 24 '12 at 12:10

1 Answers1

1

ADO.Net is used by EF under the scenes. This means that overall EF is always going to be slower than ADO.Net (assuming they both are generating similar SQL statements)

However I have observed an interesting performance characteristic with EF5 vs ADO.Net and a low number of rows (either queried or inserted). EF5 appears to be consistently faster than ADO.net for under 10 items. I imagine this is due to an optimisation at connection setup time however I haven't yet tracked down what this is.

My results around this and a little more explanation is avaliable here

If anyone has any more information around why EF5 appears so fast on small datasets I would love to hear.

NOTE in this post I actually don't show the raw ADO.net results but they are very similar to the dapper results. I actually wanted to answer this specific question before posting the ADO.Net results :)

undefined
  • 33,537
  • 22
  • 129
  • 198