Skip to content

test(592): the packet envelope's throughput, so the candidate can be priced (AE#592) - #603

Merged
superuser404notfound merged 1 commit into
mainfrom
perf/592-packet-envelope
Sep 22, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
perf/592-packet-envelope

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

No production change. This adds the instrument that prices the thread's leading mechanical candidate, and the number kills it.

What it measures

SoftwareStoredPacket is the envelope every compressed byte on the software VOD route crosses twice, once into the on-disk spool and once back out, at roughly 425 KB per video packet. The thread named its PropertyListEncoder/Decoder round trip plus five to seven copies as the leading candidate for the route's per-byte cost.

Each round gets its own payload, so a copy the encoder makes is a copy the number contains. On an M1:

200 packets, 81.1 MB: encode 0.079 s = 1028 MB/s (395 us/pkt),
                      decode 0.006 s = 12670 MB/s (32 us/pkt), envelope overhead x1.0007

At the session's roughly 10 MB/s that is about 24 packets per second, so 24 x 427 us is around 1% of one core. Five times slower on an A15 still leaves 5%, which cannot account for the reported gap.

The 395 us for 425 KB is about four to five full copies, so the "five to seven copies" reading was accurate. The inference that they are expensive was not. The envelope also adds 0.07% to the payload, so nothing is being base64 inflated.

So the candidate is dead and should not be optimised. Halving a 1% cost is busywork, and the issue comment records the measurement so the next reader does not re-propose it.

Why the tests are a safety net rather than RED/GREEN

This is a measurement, not a behaviour change, so there is no failing test to write first. The three round-trip cases exist because taking the measurement meant being ready to change the encoding, and the envelope is documented as lossless with DTS, duration and side data required to survive a cache hit. They cover an empty payload, a 425 KB payload with side data, side-data order and type, and Int64.min/Int32.max scalars that a narrowing encoder would quietly clamp.

The throughput case asserts nothing about timing on purpose: a floor pinned here would be a CI coin toss. It prints.

Full suite green, 3341 tests in 451 suites.

🤖 Generated with Claude Code

https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f

…priced (AE#592)

The leading mechanical candidate for the software route's per-byte cost was the
PropertyList round trip every packet crosses on the way to the on-disk spool.
This measures it instead of arguing about it, with a payload per round so a copy
the encoder makes is a copy the number contains.

Read on an M1: encode 1028 MB/s (395 us per 425 KB packet), decode 12670 MB/s
(32 us), envelope overhead x1.0007. At the session's roughly 10 MB/s that is
about 1% of one core, so the candidate cannot account for the reported gap. The
"five to seven copies" reading was right; the inference that they are expensive
was not.

The three round-trip cases are the safety net that made the measurement safe to
take: the envelope is documented as lossless and DTS, duration and side data
must survive a cache hit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
@superuser404notfound
superuser404notfound merged commit dc4f712 into main Sep 22, 2026
7 checks passed
@superuser404notfound
superuser404notfound deleted the perf/592-packet-envelope branch September 22, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant