Repository navigation
Description
Found in an audit of main (07972d7) for hand-enumerated fast paths and dispatch that is not devirtualized. The rule: one generic or structural path, specialized by the compiler, never a hand-written list of types, sizes or key kinds; a capability is reached by a constrained call on the formatter's struct type parameter, never an interface cast. Gain figures are estimates until a runner A/B.
F4 (C) Block formatters do not compose: KeyValuePair, ValueTuple, DateTimeOffset
-
KeyValuePairFormatter.cs:18-58andTupleFormatters.g.cs(tools/CodeGen):FixedSize/BlockMaponly when every
item is raw;NinoBlockMap.Block<TItem, TFormatter>(NinoBlockMap.cs:58-72) already merges a nested block's
map (generated structs use it). So(int, DateTimeOffset),KeyValuePair<int, MyBlockStruct>, a pair holding a
[NinoType]struct with a bool or a nested fixed struct,(Guid, (int, bool))are written element by element. -
DateTimeOffsetFormatter(PrimitiveFormatters.cs:58-130) is noINinoBlockFormatter; insteadNinoElements
names it in four places (:284-285ReadOverwrites,:396BlockStride,:460-462WriteBlock,:528-534Read).
Because it is not a block, nothing containing a DateTimeOffset (a tuple, a pair, a dictionary value through
NinoBlockPlan,PriorityQueueHeap.TryWrite) is a block either. -
Fix: DateTimeOffsetFormatter implements
INinoBlockFormatter<DateTimeOffset>(FixedSize 10, WriteFixed/ReadBlock =
its Write/Read, BlockMap null or the probed ticks/offset runs), and the fourtypeof(DateTimeOffsetFormatter)tests
go. Pair and tuple formatters: an item is raw or a block (NinoBlockPlan<Ti,TFi>.Size > 0), FixedSize the sum,
BlockMapthrough.Block<Ti,TFi>, WriteFixed/ReadBlock throughNinoBlocks.WriteFixed/ReadBlock(constrained
calls). Route every collection of T? and NinoNullable<T> through the shared block element path #295 (T? and NinoNullable as a "fourth kind" in NinoElements) is the same move for slots: once every
fixed-size formatter is a block formatter, NinoElements has one kind, not four. -
Gain: one reservation per collection instead of one per element, plus the vector block paths where a map exists;
Rust's equivalent change (FIXED_SIZE for derived structs) measured 61-91 % faster (blocks.md). Estimate 1.5-3x for
List<(int, DateTimeOffset)>-like cases. -
Risk: bytes identical by construction (golden/conformance tests prove it); Untrusted checks of nested items must
reachNinoBlockMap.Checked; netstandard per-element interface call (F2) until F2 lands. -
DateTimeOffsetFormatterasINinoBlockFormatter; the fourtypeof(DateTimeOffsetFormatter)tests removed -
KeyValuePairFormatterand the CodeGen tuple formatters: items raw or block,NinoBlockMap.Block -
golden bytes and conformance unchanged; Untrusted checks of nested items
-
A/B: lists/arrays/dictionary values of
(int, DateTimeOffset),KeyValuePair<int, BlockStruct>
Sibling of #295 (the T? and NinoNullable part of the same rule).
Generated by Claude Code
Activity
JasonXuDeveloper commentedon Nov 18, 2026
This issue is now part of #355's single mechanism; see the rules at the top of #355's body and this comment.
One composition rule. Composite elements, meaning
KeyValuePair,ValueTuple/Tupleof any arity, and generic[NinoType]structs and classes, derive their kind from their members once per closed type:unmanaged;What follows from it:
Generated by Claude Code
refactor(core)!: decide each element's kind once, in NinoKind (#407)
feat(core)!: composites compose their block from their items (#408)
JasonXuDeveloper commentedon Nov 18, 2026
This landed on
feat/storage-layerin #408 (merge 79bfcac). CI was green, including Unity 2022.3, 6000.6 and WebGL.What changed
NinoBlockMap.ItemandNinoBlocks.ItemSize/WriteItem/ReadItemput the composition in one place. "Raw" is decided by the layout check, not byunmanaged.KeyValuePair, every tuple including the 8-itemValueTuple, and the generator's generic structs. Composites such as(int, DateTimeOffset),KeyValuePair<int, BlockStruct>and generic[NinoType]structs with fixed-size members are now blocks.DateTimeOffsetis now a block formatter. Its own loops and thetypeoftests are gone.Still open
Both are tracked in #355. This issue closes with the pull request that takes
feat/storage-layertomain.Generated by Claude Code
feat(core)!: one run cursor and one write loop per element kind (#409)
JasonXuDeveloper commentedon Nov 18, 2026
Progress from #409 (merged into
feat/storage-layer, part of #355): this issue's writes now go through Core's run cursor and one write loop per element kind. The dispatch chain is emitted inside Core's skeleton as one non-genericWriteRun, and the per-containerWriteElements/WritePairs*entry points are removed. The bytes are unchanged. Reads follow in the next step. The issue closes with the finalfeat/storage-layer→ main PR and its runner A/B.Generated by Claude Code
perf(core): one read and one write of a SortedList, the merge's curso…
JasonXuDeveloper commentedon Nov 20, 2026
#432 (26a37c4) checked the storage side of this issue on
feat/storage-layerand found nothing left: the checklist was finished from #408 onward.Still open:
Generated by Claude Code