Performance Tuning: Entity Framework vs Dapper

Mick B
1 min readOct 29, 2017

In summary: Start with EF when you need to remain nimble. Move to Dapper when you’re ready to commit to your business logic and optimize performance.

Entity Framework vs Dapper. Which do you pick?

Entity Framework and other ORMs are convenient, but they come with a catch. Performance isn’t all that great if you’re comparing them to raw SQL due to the costs of abstraction.

Dapper might not be as accessible, but it’s a step away from stored procedures in terms of performance and a couple steps away from ORMs in terms of developer experience (you have to know a bit of SQL).

My strategy when developing new products and solutions is:

  • Develop all of the DAL using Entity Framework first — accumulate some technical debt in exchange for flexibility in the early stages of your product development.
  • As your product’s features are validated (via testing, QA, user feedback, etc), evaluate performance across your application and convert your EF queries into Dapper queries where needed. Find the bottlenecks and embrace the commitment.

Fun fact: Dapper was made by the team over at StackOverflow. Probably one of the fastest sites you’ve been on.

Thanks for reading!

Mick

--

--