Skip to content

Index into the record's values instead of enumerating them - #339

Merged
chrisrichards merged 1 commit into
mainfrom
index-record-values
Nov 23, 2026
Merged

chrisrichards merged 1 commit into
mainfrom
index-record-values

Conversation

@chrisrichards

Copy link
Copy Markdown
Member

DbfRecord.ParseValues enumerated Values with foreach. Values is typed IList<IDbfValue>, so the enumerator is obtained through the interface and allocated on the heap for every row. This replaces it with an indexed loop: same values, same order, same Read calls.

Measurements

Stopwatch harness, Release build, interleaved rounds, tl_2019_01_place.dbf (587 rows × 16 columns), Apple M3 Max:

Before After
Read() + GetValue on every field 272 µs 256 µs
Read() only 245 µs 231 µs
Allocated per pass 349.7 KB 326.8 KB

The 23 KB is one 40-byte enumerator per row. For reference, the same harness gives Sylvan 257 µs and NDbf 381 µs.

These are harness numbers, not BenchmarkDotNet runs; the published benchmark measures the released package.

Testing

Full suite: 535 passed, 1 skipped (pre-existing).

🤖 Generated with Claude Code

DbfRecord.ParseValues enumerated Values, an IList<IDbfValue>, with foreach.
Through the interface that allocates an enumerator for every row. Use an
indexed loop instead.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@chrisrichards
chrisrichards merged commit e1c64f5 into main Nov 23, 2026
3 checks passed
@chrisrichards
chrisrichards deleted the index-record-values branch November 23, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant