Benchmarks for EF 5 c# dapper entity-framework ibatis


I'm following the performance test that Dapper community created.

Currently, I'm getting the following after run the tests 10000 times:

  • EF 5 = 21595 ms
  • ADO.NET = 52183 ms
  • Dapper = 52499 ms
  • iBatis = 83138 ms

I need that something help me to understand why EF is faster. What did I do wrong?

The code that I'm using is on Github


9/27/2013 1:57:40 AM

Expert Answer

Firstly, EF did definitely get faster: they invested a lot of time improving perf - by most of my measures, it still has noticeable overhead. Consider: EF sits on top of ADO.NET. If EF is reporting results that are significantly faster than ADO.NET, then (and I think you already suspect this): you aren't measuring what you think you are measuring.

I suspect the key issue here is that you are performing all the operations on the same data-context. This means you are probably now just stressing the identity manager and cache. I can't run your code directly (because it uses Oracle etc), but it would be interesting to view the actual queries that are performed. In real world usage, each data-context has a finite unit-of work lifetime. It would be incredibly rare to execute 10,000 operations on the same data-context. More typical would be a handful of operations.

However, unrelated: I have to say: I'm very pleased with your results showing dapper as being within 0.6% of raw ADO.NET performance. This is basically exactly what we were going for with dapper: the full performance of raw ADO.NET, but simply taking away the coding pain.

9/30/2013 9:13:29 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow