Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latest Dapper VS Entity Framework 6 performance considerations

There are a few performance comparisons between Dapper (which seems to be the fastest, most popular "micro ORM tool"). Now it's September 2014 and we have Entity Framework 6 (not 5, or 4) and Dapper is still around.

We will begin developing a huge database n-tier application (database has 700 tables). And some of the queries that need to be run are quite time-sensitive.

  1. Does anyone have any updates on performance regarding EF 6.1.x? This concerns general queries made within a DbContext.
  2. I suppose I cannot use nicely formatted LINQ queries with Dapper. Do you have experience with that? Is it worth losing LINQ for the additional speed?
  3. IS Dapper still under active, constant development? GitHub tells me yes, but as with Subsonic, that can change rather quickly.
  4. Is it feasable/doable to mix Dapper and EF? Dapper when we need the speed, otherwise EF.

Thank you!

like image 327
John Avatar asked Sep 09 '14 16:09

John


People also ask

Is Dapper faster than Entity Framework?

Dapper is literally much faster than Entity Framework Core considering the fact that there are no bells and whistles in Dapper. It is a straight forward Micro ORM that has minimal features as well. It is always up to the developer to choose between these 2 Awesome Data Access Technologies.

How much faster is Dapper than Entity Framework?

In the test run in June 2018, EF Core 2.1 reached 56% of raw ADO.NET performance on a Postgres database, while Dapper reached 72.1%. In June 2022, EF Core 6 reaches parity with Dapper, both achieving 73% of raw ADO.NET performance.

Is Entity Framework slower than Dapper?

But the answer to your question is Yes, Dapper is quicker than EF Core for reading data. And it probably always will be, because it is not a full blown ORM like EF Core. It is a simple object mapper and designed specifically to be quicker than EF Core for reading data.

Is Entity Framework 6 still supported?

Versions 6.0, 6.1, 6.2, and 6.3 are no longer supported. Although Entity Framework 6. x is still supported, it is no longer being developed and will only receive fixes for security issues.


1 Answers

  1. Does anyone have any updates on performance regarding EF 6.1.x? This concerns general queries made within a DbContext?

Ans: I don't have specific numbers, but I have updated the performance rig to EF6; I can't remember the outcome exactly, but: EF6 is a lot faster than EF-old, but dapper is still significantly faster in many scenarios (and about the same for the edge-cases)

  1. I suppose I cannot use nicely formatted LINQ queries with Dapper. Do you have experience with that? Is it worth losing LINQ for the additional speed?

Ans: That is subjective; for us: yes, absolutely worth it - but we care lots about speed. Parsing expression trees has impact, and generated SQL is very rarely in the same league as handcrafted SQL by a decent dev

  1. IS Dapper still under active, constant development? GitHub tells me yes, but as with Subsonic, that can change rather quickly?

Ans: Absolutely; I think I've deployed about 4 versions this month...

  1. Is it feasable/doable to mix Dapper and EF? Dapper when we need the speed, otherwise EF?

Ans: Yes, you can do that; that is how we started with dapper - we used that to replace LINQ to SQL code that was causing performance problems; over time, that had grown, and now we have very little LINQ to SQL code remaining (but still some)

like image 68
Marc Gravell Avatar answered Sep 21 '22 03:09

Marc Gravell