# Compact bounded snapshot benchmark

Measures GET /api/orchestration/threads/:id/bounded with the compactTurnItems opt-in off and on,
with the change applied. All threads are synthetic and are seeded through the real EventSink into
a scratch SQLite file. No user data is involved.

- `measure-impl.ts` seeds 8 fixture threads, then measures the production path
  (getThreadSnapshotWindow -> projectThreadProjectionForWire -> buildBoundedThreadProjection ->
  boundedSnapshotResponseFields -> schema encode -> JSON), the raw/gzip(6)/brotli(4) sizes, and
  the client path: JSON.parse -> schema decode -> boundedSnapshotProjection.
- `results.json` holds raw results. Timings are median, first and p90 over 25 iterations.
- `run.log` is the console output plus `/usr/bin/time -v`.

Reproduce from a checkout of the PR head after `vp i`:

    node --expose-gc measure-impl.ts --repo <checkout> --db /tmp/scratch.sqlite --iters 25 --out results.json

Environment: nucbox-1 (Linux x86_64), Node v24.21.0. "equivalentAfterRestore" checks that the
canonical re-encode of decode(off) equals the re-encode of boundedSnapshotProjection(decode(on)).
The Node timings come from a desktop CPU, not a phone.
