perf(grpc-data): #1105 a queued cohort frame rides the channel as a struct, not a FrameEvent record

Release, 10k cohort: ~1.69 KB -> 1.65-1.67 KB per delivered value process-wide; queue section 40 B -> 0 B per value.

- ProjectedDataAccess's cohort channel carries a CohortMessage struct (control Event, or frame + charge + received
  timestamp); control events convert implicitly, so every writer is unchanged. Slot release, charge and dispose obligations
  on the read, drain and finally paths are unchanged.
- GrpcDataWave3PerfTests asserts queue 0 B/value, build < 192 B/value and (Release) < 1.8 KB/value process-wide.

Declined (documented in docs/DataConnections.md): ProjectedValueUpdate+DataValueSnapshot (public publish API, retained by the
publisher), the one-element publish list (reuse needs an ownership promise IProjectedValuePublisher does not make), origin
frame records (public Core.Abstractions contract; the frame is owned by the reader), CachedSourceRead (public, escapes,
identity-based once-only guards).
This commit is contained in:
Joseph Doherty
2026-12-04 20:25:00 -05:00
parent ce0133b03c
commit b03e01dae1
3 changed files with 54 additions and 9 deletions
@@ -72,6 +72,15 @@ public sealed class GrpcDataWave3PerfTests(ITestOutputHelper output)
perValue.Session.ShouldBeGreaterThan(0, "the tick seam must see the publish");
perValue.Consumer.ShouldBeGreaterThan(0, "the consumer seam must see frames");
fixture.Opens.ShouldBeLessThanOrEqualTo(3);
// #1105 regression bounds (Release, 10k cohort: ~1.65 KB/value process-wide after #1105, ~1.69 KB before). A frame rides
// the cohort channel as a struct, so queueing it allocates nothing; a value's build is the two publish-API records only.
fixture.Allocations.Section(ProjectedPublishSection.Queue).PerValue.ShouldBe(0, "a queued frame must not be wrapped in an object");
fixture.Allocations.Section(ProjectedPublishSection.Build).PerValue.ShouldBeLessThan(192,
"a value's build is ProjectedValueUpdate + DataValueSnapshot (184 B) only");
#if !DEBUG
// Debug builds keep unoptimized async state (~2.5 KB/value), so the process-wide bound is a Release figure.
(publishAllocated / (double)Math.Max(1, delivered)).ShouldBeLessThan(1800, "process-wide publish allocation per value regressed");
#endif
}
finally { foreach (var demand in demands) demand.Dispose(); }
}