DEV Community

Ali Kolahdoozan
Ali Kolahdoozan

Posted on

πŸš€ EF Core vs Dapper Benchmark – Real .NET 10 Test Results


I ran a full BenchmarkDotNet suite comparing:

EF Core (Tracked βœ… / NoTracking ❌)

Dapper (Raw SQL, no ORM fluff)

We tested:

  • SelectById
  • SelectMany (1000 rows)
  • Insert speed
  • Memory usage & allocations

πŸ’₯ Results?

Dapper crushed EF in insert performance (65x faster)

Tracking in EF adds more overhead than you think

This is a real-world test, not just theory.
πŸ“Ή Watch the video and see the numbers for yourself.

Top comments (1)

Collapse
 
calvin_nel_02afcac284f967 profile image
Calvin Nel

not ideal when to comment you have to sign-in

dapper and EF are doing different things but if you wanting to compare like this it would also benifit from comparing if the same feature exists...

Example:

var sql = "INSERT INTO Orders (Id, CustomerName, OrderDate, TotalAmount) VALUES (@p0, @p1, @p2, @p3)";
    await _context.Database.ExecuteSqlRawAsync(sql, order.Id, order.CustomerName, order.OrderDate, order.TotalAmount);
Enter fullscreen mode Exit fullscreen mode

this would be closer to Dapper in terms of doing the same thing... and on performance..

i just think its important to understand the tooling and whats it offers, strength and weeknesses.

would love to see a big project... with lots of funcactionlity changed at wim to a different DB all together...

dont get me wrong i think both have their place, and if used correctly can be very powerful.