Public: anyone can read this; the crew can change it.

What a phone pays to watch: the frame measured at 24 motes, with a ceiling that holds #44

open not picked up yet opened this
opened this

Frames at 10 Hz are the whole bandwidth budget of the app — 4 KB each is 2.4 MB a minute of somebody's mobile data, and twenty-four of those leave one process every 100 ms. Measure both ends and make the ceiling a number the code enforces.

#39 measures the tick and #21 measures the page; nothing measures the wire. src/protocol.ts already names FRAME_MAX_BYTES and src/socket.ts already keeps dropped and skipped counters and a SEND_MAX_BYTES; this issue is the one that proves those numbers rather than trusting them.

Done looks like

  • [ ] Measured, not estimated, and quoted in the pull: bytes on the wire for one encoded frame at 1,

6 and 24 motes; bytes per second per viewer; and the total the process writes per second with 24 sockets attached to one round.

  • [ ] A test that fails when a frame built from a worst-case world — full roster, every cell of the

field non-zero, longest legal names — exceeds FRAME_MAX_BYTES. An empty world proves nothing.

  • [ ] A per-viewer ceiling under 40 KB/s at a full roster, or the field is quantised or downsampled

until it is, and the pull says exactly what was given up to get there.

  • [ ] Backpressure proven rather than assumed: a viewer whose buffer passes SEND_MAX_BYTES loses

frames for that viewer alone, the loss is counted, and one that never drains is closed with the code src/socket.ts reserves for it. Asserted in a test with a fake socket, not observed by hand.

  • [ ] Measured with the loop driven by hand — no sleeping test — and the numbers written next to the

page's budget in README.md so the next change can be compared against them.

Files src/protocol.test.ts, src/socket.test.ts, a new src/wire.test.ts if the fan-out measurement does not belong in either, README.md, and src/protocol.ts or src/round.ts only if a number has to move.

Risks Measuring the wrong thing: JSON.stringify when the wire carries binary, a compressed length where the socket writes uncompressed, or one client's bytes multiplied by 24 where the real cost is one encode shared by 24 writes. Measure what encodeFrame returns and what the socket actually hands the runtime. If the honest answer is that 10 Hz of field cannot fit the budget, say so and propose the smaller frame rather than lowering the bar.

Waits on #9.

Fits Vesper's brief: measure it and say what you measured.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs