Sequence node affinity experiment

This isolated source copy evaluates a placement change to the current pooled Store. It is not a second supported implementation. Production remains unchanged until matched measurements and review support a decision.

The copy comes from the accepted 355-file final-source.tar.gz under research/artifacts/2026-10-16-store-sessions-pools/. All input hashes were verified before editing. source-before.json, source-after.json and changed-inputs.json identify the exact changes.

The sole production-code change allocates a sequence radix node from the size class max(256, chunk_bytes<T>()). Its logical contents remain 256 bytes; all index reads, writes, traversal, pruning and ownership rules are unchanged. For u64, radix nodes and 272-byte data chunks therefore share a resource-owned pool. This tests whether related index/data writes can stay close without giving up compact reusable slots. Pool initialization clears the complete slot, so a reused slot may safely change its structural role.

The existing exact empty-cache tests were adjusted only for the changed number of used size classes. Other correctness assertions remain intact. Tests cover fixed, zero-width, variable-inline and external/reference-bearing values in both placements, reopen, rolling history, cursor invalidation and reclamation.

This first candidate intentionally applies the rule to all sequence value representations. Large chunks can substantially pad each individual index node, although the radix directory contains far fewer nodes than the data sequence. Native footprint measurements must account for pool rounding, not only logical padding. No claim of a universal performance improvement or large-type policy is made before those results. A future eligibility bound is a separate hypothesis.

Qualification uses matched Queue/Ring/Log benchmarks, cold single-read positions, bounded batches, creation, drain/reuse and actual growth boundaries. The earlier Ring overwrite regression was a cold write to a tail index in a different region from already-dirty tail data; native ordered traces identify that path. This experiment must protect the gains from compact index reads as well as improve that mutation path. Build outputs reuse the existing targets; no target cache was copied here.

Measured limits

The isolated candidate passed all 42 focused native sequence tests and source review. Its IC cohorts contain 120 standard collection observations, 192 cold single reads and 180 expanded mutation observations.

For u64, the candidate removes the targeted Ring overwrite penalty: 100k-entry overwrite32 falls from 824,264 to 660,946 body instructions retained, and 894,032 to 730,903 stable. It also reduces used empty-pool retention by one control and one slab. These are comparisons against the current separate-pool candidate, not against mo:fast.

The change redistributes costs. Stable 100k read32 adds 80,000 instructions relative to separate pools, although it remains below the original pre-pool baseline. Cold-read means improve in three measured groups and are unchanged in one, but individual positions still regress by 80,000. Cold drained reuse remains substantially slower than the original baseline. Newly allocated pooled backing appears at different sequence lengths, so the growth comparison uses the union of exact logical inputs rather than treating different growth calls as matched.

The universal rule is unsuitable as a default without further qualification. The wide-value native diagnostic finds that 32k fixed64/variable-inline64 entries use 3.166% more allocated bytes. More seriously, the same indexed32 operation and same requested byte count spread over 34→58 retained and 35→60 stable 64-KiB regions. The padded wide index occupies one slot per slab and loses the previous compact-directory locality. These are native source-range observations, not measured IC faults or timing for wide values. External1024 values increase total allocation by only 0.012%, while u64 allocation decreases. Any bounded eligibility policy must be a separately recorded candidate; this universal source and its evidence remain immutable.