7

I used dapper.net as micro-orm, speed and performance is fantastic.

Simple CRUD Operations in Dapper is more quickly than Entity Framework 6.

Speed-Comparison-Dapper-vs-Entity-Framework

But if I want speed and performance of Entity Framework 6 like Dapper, what should I do?

I do not need all the advanced features of Entity Framework 6 so

Can I disable some features to increase speed and performance of Entity Framework 6? Which one?

Which features are costly and increase the speed to disable them? (Please specify)

Uwe Keim
  • 36,867
  • 50
  • 163
  • 268
Hamed F
  • 720
  • 2
  • 10
  • 22
  • 1
    Which performance issues are you talking about? Have you got particular scenario in mind? Is it startup, some specific query or something else? Do you have numbers to base your claim that EF is much slower than Dapper.NET? – dotnetom Aug 03 '14 at 18:08
  • @dotnetom Simple CRUD Operations – Hamed F Aug 03 '14 at 18:09
  • @user3432343 Isn't Dapper enough for that? – Benjamin Diele Aug 03 '14 at 18:13
  • @Benjamin Diele , Dapper is enough but we can not use mixed orm in our framework , we want to use Entity framework with maximum speed and performance (Code first mode) – Hamed F Aug 03 '14 at 18:15
  • 1
    Take a look at my tests and suggestions on how to speed up EF. http://www.wiktorzychla.com/2013/05/yet-another-orm-micro-benchmark-part-23_15.html In particular 1) repeat your tests with different number of entities 2) use .AsNoTracking() to speed up reads 3) always measure test on a 2nd run, during the first run EF internals are created and cached – Wiktor Zychla Aug 03 '14 at 18:23
  • You cant get the same performance with EF as with Dapper due to the nature of EF. The performance has improved since the latest version and with .NET 4.5 but its never going to be the same as Dapper/Other micro-ORM. The flip side of that is that you get so much more features with EF, so you need to weigh them up. Do you want purely performance or more features? – CallumVass Aug 03 '14 at 18:26
  • What you're asking for is pretty much the same as "I want the same performance, handling, and ability to weave in and out of traffic with my dump truck as I get with my motorcycle." It's just not possible. The reason that Dapper is so fast is because it doesn't do as much. Just like a motorcycle is faster and more maneuverable because it doesn't have to haul around a giant load of stuff. – Erik Funkenbusch Aug 03 '14 at 18:42
  • Still, there is hope. While EF will never be as fast as small, efficient, highly optimized micro-orms, the EF team is working hard to rewrite EF to be more modular and allow you to "turn off" features like you are suggesting. EF6 does not allow this, and is a much more monolithic code base. It has minimal ability to "turn off" things, primarily focused around "conventions". However, these limited features won't give you any performance boost. – Erik Funkenbusch Aug 03 '14 at 18:46
  • There are any number of articles on the net about optimizing EF, including suggestions of keeping contexts small (EF6 allows you to create more than one context more easily), pre-generating views, limiting your queries to certain feature sets, etc... – Erik Funkenbusch Aug 03 '14 at 18:47

1 Answers1

8

Simple CRUD Operations in Dapper is more quickly than Entity Framework 6.

Yeah. So what? EF is known to be slow. Deal with it. It is documented and a work item they hope to work on some point before EF 100. They got faster already but they still are slow.

But if I want speed and performance of Entity Framework 6 like Dapper, what should I do?

1: use Dapper.

Or:

2: sit down with the EF source code and fix the issues and submit it as a patch.

Can I disable some features to increase speed and performance of Entity Framework 6 ?

Entity Framework is Too Slow. What are my options?

Community
  • 1
  • 1
TomTom
  • 1
  • 9
  • 78
  • 143