1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//! Wall-clock A/B cases for the multi-sink split terminal.
//!
//! One shape, parameterized by the two things the terminal varies: how many
//! branches it fans out to, and what share of records match one. A poll batch
//! is deserialized straight into a
//! [`split`](spate_core::ops::ChainBuilder::split) terminal, dispatched to
//! typed branches, and drained to encoded chunks. The split's per-record cost
//! is an `Any` downcast to discriminate the branch, an `AckRef` clone, and a
//! boxed router and encoder call each.
//!
//! The rig lives in `benches/support/split_rig.rs`, shared with the
//! instruction-count sibling in `benches/split_gungraun.rs` and pinned by
//! `tests/bench_fixtures.rs`.
//!
//! Run: `make bench-ab REF=main FILTER=split_`
//!
//! # Reading these numbers
//!
//! - **`bytes_per_s` is the figure comparable across all three cases.** Every
//! corpus here is the same number of bytes, because the tag byte changes
//! which route arm runs and not the payload width, so the byte denominator
//! is one constant and the cases differ only in the work behind it.
//! - **`records_per_s` drops by a quarter** in
//! `split_four_branches_quarter_unrouted`, because a quarter of the batch
//! reaches no branch and produces no row. That is the axis, not a
//! regression. The case prices a route closure that falls through against
//! one that always matches.
//! - **Both four-branch cases are marked erratic**, so they are measured and
//! reported but never reach the significant-changes table (see
//! [`FOUR_BRANCH_ERRATIC`]). They place occasional replicates well above
//! their own mode on the reference machine, enough to flag a change that
//! never happened, and nothing in the measured region accounts for it. Read
//! their rows; do not gate on them. `split_two_branches` is the case here
//! that gates.
//! - **The counts come from the rig, not from a literal.** `.items_of()` reads
//! `Rig::expect_rows`. That is a second statement of the tag distribution
//! rather than a derivation from it, since `Tags::routed` is arithmetic
//! written beside the cycle and not read off it. The two are tied together
//! elsewhere. The routine asserts the driven count against it every
//! iteration, and `tests/bench_fixtures.rs` counts the corpus's tag bytes
//! against both.
//! - **The state is a `RefCell`** because the harness hands a case's routine
//! `&S` while `Rig::drive` takes `&mut self`. One borrow flag per iteration
//! against a region of hundreds of microseconds, paid identically by both
//! legs.
//!
//! # What the measured region carries that production does not
//!
//! `Rig::drive` mints a fresh `AckRef::test_pair()` and sweeps every branch's
//! receiver inside the region. In production a source owns the first and a
//! shard worker the second. The sweep grows with the branch count whether or
//! not a branch is idle, so the four-branch cases are read against each other
//! and against the two-branch case rather than in absolute terms.
//!
//! Nothing returns bytes to the `InflightBudget`, so it climbs across a
//! calibrated run. The climb is cost-neutral. The seal path's `add` is one
//! value-independent atomic and nothing in the rig reads `usage()`.
use ;
use RefCell;
use ;
/// Fold a rig's corpus into the harness's digest.
/// Why both four-branch cases are reported but never flagged.
///
/// Established across five A/A runs (one commit on both legs, corpus digests
/// matched, allocation counters identical to the byte). Both four-branch cases
/// hold a ~163 µs mode and then place occasional replicates at ~200-208 µs,
/// one to three in ten, which is enough to clear the 5% floor whenever two or
/// more land together. It moved between the two cases run to run rather than
/// staying with either, so it is a property they share and not of one corpus.
///
/// The machine was not drifting under everything. `split_two_branches` held to
/// 1.6% and the ten chain cases to 1% in those same interleaved runs. The
/// measured region does not account for it either. The route closure's
/// fall-through arm drops a `Record` and releases one `AckRef` clone, a
/// decrement rather than a branch, and the corpus and chunk arithmetic are
/// pinned by `tests/bench_fixtures.rs`. These two differ from the two-branch
/// case in that their per-branch buffers stay under the 64 KiB chunk target, so
/// a chunk seals only at `flush`; the cause beyond that is unexplained.
///
/// This records an observation on one machine, not a diagnosis. Re-test on
/// dedicated hardware before the marking is lifted.
const FOUR_BRANCH_ERRATIC: &str = "occasional replicates land about 25% above the case's mode on \
the reference machine; the two-branch and chain cases do not";
/// Rows a case's batch produces, as the rig itself computes it.
/// Payload bytes a case's batch ingests.
///
/// Summed from the corpus rather than stated as a constant, so a payload shape
/// that drifted moves the denominator with it instead of leaving `bytes_per_s`
/// describing a corpus that no longer exists. `tests/bench_fixtures.rs` pins
/// the shape itself and pins all three corpora to the same size, which keeps
/// this denominator one constant across the cases.
/// A case that drives a whole batch through a built split chain.
///
/// The row assertion stays inside the measured region, as the counted tier's
/// does. It is one comparison against thousands of records of work, and it
/// stops a corpus that quietly stopped reaching a branch from passing as a
/// fast case. The count is also what `black_box` holds.
bench_main!;