You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e69a759
Browse filesBrowse the repository at this point in the historyBrowse files
Benchmarks re-measured on the release candidate: 2.4 to 2.8 times faster than Dapper on multi-row reads, records cost the same as classes, and ODE's time per row is 15 to 25% above the old numbers (unchanged by the recent work) (#83)
* Benchmarks: a Record scenario (the 12-column Post as a positional record) against Dapper's constructor mapping
RecordList and RecordFirst at 1, 100 and 1000 rows. Setup checks that both libraries return equal records. Built, not run: running it needs the owner's go.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Benchmarks: Array, First and List re-measured on the release candidate; a Records section
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
- Not measured here: real network/database time (the provider is in-memory). Cross-check against a real provider before quoting these as end-to-end gains.
11
+
-**Re-measured 2026-11-08** on the release candidate code (master 41af17c): the `Array`, `First` and `List` rows below and the new `Record` rows, as scoped runs with nothing else running on the machine. The other rows are earlier measurements and were not re-run. Against the earlier `Array` and `List` rows, ODE's time at 100 or more rows is 15 to 25% higher (a 100-row `List` took 3248 ns, now 4030 ns); it is the same as on the last commit before constructor binding (a 100-row `Array` took 4166 ns there, 4254 ns now), so the last changes did not move it. Allocations are the same or lower (`First` 312 B to 280 B, a 1-row `List` 400 B to 368 B). Ratios against Dapper moved from about 0.3 to about 0.4, which is still 2.4 to 2.8 times faster.
The same 12-column `Post` as a positional record (`PostRecord`), read through its constructor by `Map<T>()`, against Dapper's constructor mapping (`RecordBenchmarks.cs`; re-measured 2026-11-08, master 41af17c).
A record allocates exactly what the same model as a class allocates (13,560 B for 100 rows), so constructor binding costs no memory.
84
+
69
85
## Reading the table
70
86
71
87
-**Speed:** ODE is at or below Dapper's time in all 54 rows (worst: async scalar at 0.98, i.e. a tie). Mapped results are 2-3x faster at 100+ rows and 2-9x faster for `First`/`Single`.
Copy file name to clipboardExpand all lines: docsite/articles/whats-new-11.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Version 11 is a performance release and a tidy-up release. Result mapping is rew
7
7
8
8
## Highlights
9
9
10
-
-**Faster, allocation-light mapping.** The mapping for a result-set shape is compiled once and cached, and values are read with typed getters, so nothing is boxed on the common path. Before, every `Map<T>()` compiled a setter per property (about 0.94 ms per query in the library's benchmark). In that benchmark (in-memory provider, 12-column rows, Dapper 2.1.89), reading 100 or more rows into a list, array or stream takes 0.29 to 0.32 times Dapper's time and 0.33 to 0.37 times its allocations (the library's own benchmark, `Benchmarks/RESULTS.md`; the independent preview01 re-run quoted in the README and [Performance](performance.md) is more conservative: 2 to 3 times faster, 0.33 to 0.38 of the allocations). Against SQL Server LocalDB the database dominates: times are 0.92 to 1.04 times Dapper's in that benchmark (0.89 to 1.08 in the re-run), within the noise, and allocations 0.55 to 0.6 times on multi-row results.
10
+
-**Faster, allocation-light mapping.** The mapping for a result-set shape is compiled once and cached, and values are read with typed getters, so nothing is boxed on the common path. Before, every `Map<T>()` compiled a setter per property (about 0.94 ms per query in the library's benchmark). In that benchmark (in-memory provider, 12-column rows, Dapper 2.1.89), reading 100 or more rows into a listor array takes 0.36 to 0.42 times Dapper's time (2.4 to 2.8 times faster) and 0.33 to 0.37 times its allocations (`Benchmarks/RESULTS.md`, re-measured on the release candidate; a positional record costs the same). Against SQL Server LocalDB the database dominates: times are 0.92 to 1.04 times Dapper's in that benchmark (0.89 to 1.08 in the re-run), within the noise, and allocations 0.55 to 0.6 times on multi-row results.
11
11
-**`RowMap<T>`: declare a column mapping once.**`public static RowMap<Post> PostMap => field ??= [new(nameof(Post.Id), "post_id"), ...];`, passed as the `map` argument of every method that maps rows to a model. It takes one pair, several or none, and a read through it allocates what `Map<T>()` allocates. With no map, a column matches a property exactly, else ignoring case, else ignoring case and underscores (`first_name` fills `FirstName`). Only public instance properties are mapped. See [Columns named differently](mapping.md#columns-named-differently) and [snake_case columns map to PascalCase properties](mapping.md#snake_case-columns-map-to-pascalcase-properties).
12
12
-**`MappedQuery<T>`: direct read loops, and one token for the whole call.**`Map<T>()` returns a deferred query. `ToList`, `ToArray`, `ToImmutableArray`, `ToHashSet`, `ToDictionary`, `FirstOrDefault`, `SingleOrDefault`, `Read` and their async twins read straight from the reader; `Skip` advances without mapping and `Take` stops reading once it is met. They are instance methods, so the query struct is not boxed; the `IMappedQuery<T>` extensions remain for generic code. The token passed to an async terminal is used together with the command's `UseCancellationToken` token, and either one cancels the whole call: opening the connection, looking up parameter names, executing and reading. Readers open with `SequentialAccess | SingleResult` (`Map(selector)` skips `SequentialAccess`, because a selector may read columns in any order). See [Terminals](expressive-commands.md#terminals).
13
13
-**Less overhead around the query.**`IExecuteReader` has state-passing `ExecuteReader<TState, TResult>` overloads, so a `static` lambda allocates no closure. A command created from a connection allocates no pool wrapper, `Params` is created on first use, and async execution skips awaiting when the connection is already open.
0 commit comments