pub const PART_BUILDER_OVERHEAD_BYTES: usize = 704;Expand description
Per-polynomial live heap a cycle holds that size_of cannot account for, in bytes.
peak_cycle_bytes reads the structural per-polynomial terms — the part builder, the shared
surplus counter, and the commitment map entry retained behind them — straight from the types,
so they track the curve and the structs without anyone maintaining a number. This covers what
is left:
SsaBuilder’s received-index set, sized atnum_polyson construction;- the
Box<[_]>header the part builders live in, and allocator rounding on both collections; - the acknowledgement-path residue a cycle drags along while it fills.
awaiting_acksis bounded globally bymax_ack_buffer_bytesrather than per cycle, butmokaapplies removals on a later maintenance pass, so a cycle being fed at line rate carries a backlog of redeemed-but-not-yet -reclaimed entries. Charging a slice of it twice is deliberate: it is the difference between a model that is a ceiling and one that is merely a good estimate.
Measured, not derived, like AWAITING_ACK_ENTRY_BYTES:
exit_reconstructor_worst_case_share_order in tests/memory_profile.rs prints the modelled and
measured per-polynomial figures side by side with the share buffers subtracted, which is exactly
this number. Run it to re-derive every figure below.
The arithmetic, at the time of writing and at the deployed dimensions:
- measured per polynomial, share buffers excluded: ~880–905 B. A range because it is a range: the acknowledgement residue is a scheduling artefact, and two runs of the same test on the same machine gave 876 B and 904 B. That variance is the reason this constant is set with headroom rather than at the measurement;
- of which
size_ofaccounts for 458 B, leaving a ~420–450 B residue the types cannot see; - this constant is 704 B, ~1.6× that residue, so the model charges 458 + 704 = 1162 B per polynomial — ~30 % above the measurement;
- across a whole cycle that dilutes to ~6 %, because the share buffers are modelled exactly and dominate: 41.1 MiB modelled against 38.8 MiB measured, of which 32.0 MiB is share buffers.
Both headroom figures are worth keeping straight, because they answer different questions: ~30 % is the margin on the term this constant actually sets, and ~6 % is the margin on the number the Session layer’s live-cycle budget is denominated in.
Headroom rather than the measured figure for the variance above, and because understating this would let that budget be exceeded.