NPoco vs UkrGuru.Sql: When Streaming Beats Buffering
When we talk about database performance in .NET, we often compare ORMs as if they were interchangeable. In practice, the API shape matters just as much as the implementation. In this post, I benchm...
Source: dev.to
When we talk about database performance in .NET, we often compare ORMs as if they were interchangeable. In practice, the API shape matters just as much as the implementation. In this post, I benchmark NPoco and UkrGuru.Sql using BenchmarkDotNet, focusing on a very common task: reading a large table from SQL Server. The interesting part is not which library wins, but why the numbers differ so much. TL;DR: Streaming rows with IAsyncEnumerable<T> is faster, allocates less, and scales better than loading everything into a list. Test Scenario The setup is intentionally simple and realistic. Database: SQL Server Table: Customers Dataset: SampleStoreLarge (large enough to stress allocations) Columns: CustomerId FullName Email CreatedAt All benchmarks execute the same SQL: SELECT CustomerId, FullName, Email, CreatedAt FROM Customers ` No filters, no projections — just raw read performance. Benchmark Code `csharp using BenchmarkDotNet.Attributes; using Microsoft.Data.SqlClient; using NPoc