feat: direct varData properties (#162) + foreach vs callback bench (#156)#163
Merged
Conversation
Adds GroupForeachVsCallbackBenchmarks comparing the v1.5.0 foreach-style
group enumerator against the original ReadGroups callback API on
MarketDataData (two simple top-level groups), parameterized over
GroupSize ∈ {10, 50, 100}.
Results on AMD EPYC 7763 / .NET 9 (GroupSize=100):
Callback 999 ns 152 B 1.00x
Foreach 184 ns 0 B 0.18x
Foreach + break 3 ns 0 B 0.003x
Foreach is ~5x faster on full iteration and eliminates the 152 B
per-call closure allocation. Early break is essentially free because
each group property does an O(1) skip rather than running every entry.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose top-level <data> fields as zero-allocation direct properties on
the {Msg}DataReader ref struct, alongside the existing ReadGroups
callback API. Each property recomputes its offset by chaining the
existing Skip{Group} helpers (O(1) per simple group) plus per-data
SkipData{Prev} helpers — fully stateless, safe regardless of access
order, no closure capture.
Gated on the same condition as the foreach group enumerators (#156):
all top-level groups must be simple (no nested groups, no group-level
varData). Also valid when the message has no top-level groups.
Property emission is suppressed when a varData name collides with a
reserved member of the reader struct (e.g. <data name="data"> would
clash with the Data block accessor); ReadGroups remains usable for
those fields. SkipData helpers are still emitted for skipped names so
that subsequent varData properties resolve correctly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes around the v1.5.0 enumerator work, shipped together as v1.6.0.
feat: direct varData properties on
{Msg}DataReader(#162)Expose top-level
<data>fields as zero-allocation direct properties alongsideReadGroups. Each property recomputes its offset by chaining the existingSkip{Group}helpers (O(1) per simple group) plus per-dataSkipData{Prev}helpers — fully stateless, safe regardless of access order, no closure capture.Gating (same as #156 enumerators): all top-level groups must be simple (no nested groups, no group-level varData). Also valid when the message has only varData. When a varData name collides with a reserved member of the reader struct (e.g.
<data name="data">clashing with theDatablock accessor) the direct property is silently skipped;ReadGroupsremains usable.For repeated reads, cache the returned value locally (documented in the XML doc on the property).
bench: foreach vs callback group decode (#156)
Adds a benchmark validating the perf premise of the v1.5.0 foreach enumerator API.
Tests
Release
[1.6.0] - 2026-04-29.