On real databases
The question: the synthetic reader has no database behind it. How much of ODX's lead survives when a real provider does the work?
In short
- On SQL Server LocalDB,
Map<T>()ties with hand-written code and is ahead of Dapper. For 10,000 rows of 20 columns it took 25.6 ms, a hand-written selector 25.5 ms and Dapper 29.4 ms, which is 14.9% longer thanMap<T>()(the error margins do not overlap). BenchmarkDotNet's own error margin on the 20-column SQL Server runs is 2.7 to 4.9% of the mean (the tables show each one), so the gap to hand-written code is not a result. Map<T>()allocates less than Dapper on both databases. On SQL ServerMap<T>()allocates 9.48 MB, the same as hand-written code; Dapper allocates 12.27 MB, 29.4% more. On SQLiteMap<T>()allocates 12.51 MB: 15.4% less than Dapper (14.79) and 4.6% more than hand-written code (11.96).- On SQLite
Map<T>()is behind hand-written code and ahead of Dapper.Map<T>()is 4.8% slower than a hand-written selector at 20 columns (27.9 against 26.6 ms, within the error margins) and 15.1% slower at 5 columns. It is 23.2% faster than Dapper at 20 columns and 26.4% faster at 5. Dapper's 20-column SQLite figure here (36.3 ms) is higher than in the two runs on ODX against Dapper and hand-written code, where it is 29.8 ms against 27.7 ms forMap<T>().
Time per call
Time to read 10,000 rows of 20 columns, on two providers drawn on one scale. Shorter is better. The bars inside each panel are ranked, best first. On SQL Server four bars are close and Dapper is clearly behind; on SQLite two are ahead, two follow close behind, and Dapper is far behind.
Memory per call
The same cases, measuring the memory each call allocates. They do not depend on how busy the machine was.
The numbers
Each table lists time and memory for the same five ways of reading the rows. Hand loop is a loop written directly on the provider's reader, with typed getters. Factory map, domain object is a factory map straight to the domain object: one object per row, built while the reader is open.
20 columns, 10,000 rows
SQL Server LocalDB
| Rank | Variant | Time per call (ms) | Error margin | Against the best | Memory per call (MB) | Against the least |
|---|---|---|---|---|---|---|
| 1 | Hand loop (reference) | 25.04 | ±2.9% | best | 9.48 | best |
| 2 | Map(selector), hand-written | 25.52 | ±4.9% | +1.9% | 9.48 | +0.0% |
| 3 | Map<T>() | 25.57 | ±2.7% | +2.1% | 9.48 | +0.0% |
| 4 | Factory map, domain object | 25.85 | ±3.1% | +3.2% | 9.48 | +0.0% |
| 5 | Dapper Query<T> | 29.39 | ±4.6% | +17.4% | 12.27 | +29.4% |
SQLite file
| Rank | Variant | Time per call (ms) | Error margin | Against the best | Memory per call (MB) | Against the least |
|---|---|---|---|---|---|---|
| 1 | Hand loop (reference) | 25.75 | ±6.3% | best | 11.96 | best |
| 2 | Map(selector), hand-written | 26.57 | ±5.5% | +3.2% | 11.96 | +0.0% |
| 3 | Map<T>() | 27.86 | ±0.7% | +8.2% | 12.51 | +4.6% |
| 4 | Factory map, domain object | 28.13 | ±0.7% | +9.2% | 12.51 | +4.6% |
| 5 | Dapper Query<T> | 36.29 | ±6.0% | +40.9% | 14.79 | +23.6% |
5 columns, 10,000 rows
SQL Server LocalDB
| Rank | Variant | Time per call (ms) | Error margin | Against the best | Memory per call (MB) | Against the least |
|---|---|---|---|---|---|---|
| 1 | Hand loop (reference) | 3.00 | ±1.5% | best | 2.76 | best |
| 2 | Map(selector), hand-written | 3.01 | ±2.2% | +0.5% | 2.76 | +0.0% |
| 3 | Factory map, domain object | 3.11 | ±1.9% | +3.6% | 2.76 | +0.0% |
| 4 | Map<T>() | 3.18 | ±2.9% | +5.9% | 2.76 | +0.0% |
| 5 | Dapper Query<T> | 3.23 | ±1.0% | +7.7% | 3.71 | +34.2% |
SQLite file
| Rank | Variant | Time per call (ms) | Error margin | Against the best | Memory per call (MB) | Against the least |
|---|---|---|---|---|---|---|
| 1 | Hand loop (reference) | 5.98 | ±0.7% | best | 3.74 | best |
| 2 | Map(selector), hand-written | 6.00 | ±1.0% | +0.5% | 3.74 | +0.0% |
| 3 | Map<T>() | 6.91 | ±0.6% | +15.6% | 3.74 | +0.0% |
| 4 | Factory map, domain object | 7.04 | ±0.3% | +17.8% | 3.74 | +0.0% |
| 5 | Dapper Query<T> | 9.38 | ±0.6% | +57.0% | 4.68 | +25.3% |
Why, and what to take from it
The database sets the pace. The synthetic reader serves rows for free, so the library's own work is the whole bar. Here the provider reads, parses and converts every row first, and that is most of the time. A lead of 2.6 times over Dapper on a synthetic reader becomes 14.9% on SQL Server at 20 columns, and 1.6% (within the noise) at 5 columns.
What you can count on is memory, against Dapper. Allocations are the library's, so they show through any provider. They are also what the garbage collector later pays for.
SQLite is where Map<T>() is furthest behind. The hand loop and the hand-written selector are the two leaders on SQLite at both widths. At 20 columns Map<T>() is 8.2% behind the hand loop and 4.8% behind the selector; at 5 columns, 15.6% and 15.1%.
How long the connection is held open is not on these charts. The real-provider runs measure the whole call, not how long the connection is held. The synthetic pages show the connection time, which is the number a busy service cares about.
How this was measured
- Question: how do the mapping approaches compare when a real provider is behind them?
- Setup: a table of 10,000 rows, 20 typed columns (and a second run at 5 columns). SQL Server LocalDB through
Microsoft.Data.SqlClient7.1.1; a SQLite file throughMicrosoft.Data.Sqlite. The database and the file are created for the run and deleted after it. Synchronous terminals. Every approach returns the same objects. On SQLite, Dapper maps text toGuidwith the usualSqlMapper.TypeHandlerrecipe, because it does not convert it on its own. - Settings: BenchmarkDotNet 0.15.8, in-process, 5 warm-up and 12 measured iterations, one launch, one run per case. See How we measure.
- Build, date, machine: build
6a770e8, 2026-11-23; AMD Ryzen 9 7900 (12 cores), .NET 11.0.0, Windows 10. - Data: real-providers.csv (source and conditions).
- Reproduce:
dotnet run -c Release --project Benchmarks/Open.Database.Extensions.Benchmarks -- --filter "*RealProviderBenchmarks*". SetODX_RP_PROVIDERS,ODX_RP_WIDTHSandODX_RP_ROWSto choose the case; the generator README lists the exact settings of the published runs.