# Archived threads performance proof

Synthetic data only. Web surface; Linux x86_64, 8 logical CPUs (AMD EPYC 4585PX), 16 GiB RAM. Production web builds, isolated real server instances, no copied database. Measurements use Playwright 1.64.1, bundled headless Chromium build 1248 (156.0.8078.4), 1280 × 800, dark mode. Screen recordings use visible Google Chrome 151.0.7922.108 in a 1280 × 800 viewport on a private 1280 × 900 Xvfb display (87 px browser toolbar cropped), captured externally with ffmpeg at 10 fps. Each phase uses the same setup on both commits.

Base: 14c697c4f19dbd23d21c2e91c555859f0d482e39. Head: 2b59ef3165b20090ce180314eb087ed60a9ec0d7. Only ArchivedThreadsPanel.tsx differs between these commits.

## Reproduce

1. Install dependencies in each checkout with `vp i`; run `vp build` in each apps/web package.
2. Start each real server with `T3CODE_DEV_SEED=0 T3CODE_ENVIRONMENT_LABEL="Archive benchmark" node apps/server/src/bin.ts serve --base-dir <isolated-home> --host 127.0.0.1 --port <free-port>`. Keep each database separate and fresh.
3. Issue an RPC credential to a private local file with `node apps/server/src/bin.ts auth session issue --base-dir <isolated-home> --token-only > <token-file>`.
4. Make the scratch TypeScript driver's packages resolvable from the checkout's apps/server/node_modules (a node_modules symlink beside the driver is sufficient). Run `node seed-archived.ts <origin> <token-file> 9237 <synthetic-workspace-root>`. This creates one synthetic project and creates/archives 9,237 distinct titled threads through project HTTP RPC and orchestration WebSocket RPC, with concurrency 16. Run the same script independently on both sides. The workspace can be an empty scratch folder.
5. Mint a new one-time pairing link with `node apps/server/src/bin.ts pair --base-dir <isolated-home> > <private-pair-output>` for each driver invocation. These private inputs must not be uploaded.
6. Run `node benchmark-cdp.mjs <checkout>/apps/web <origin> <private-pair-output> <output-root> before 5`; repeat with `after` against the head. The script imports Playwright from that checkout's web package. It reads measurement-cdp.js next to itself.
7. Each sample uses a fresh browser context, opens Settings → General, waits five seconds, installs the PerformanceObserver and listener/heartbeat instrumentation, and clicks the exact Archive navigation button. A Node-side 60-second clock bounds the observation; CDP reads the result directly. Each sample writes its raw JSON to a new timestamped directory. The normal browser-timer polling path starved while the base was overloaded, so CDP is used identically for both sides. No debugger, CPU profiler, video recorder or screenshot is active in the five measured samples.
8. `clickToFirstRowMs` is the first DOM appearance; `clickToPaintMs` is the following double requestAnimationFrame, used as the first post-mount paint opportunity. Long tasks use PerformanceObserver(type=longtask). `windowBlurListenersAdded` counts new window blur registrations after the click. `maxHeartbeatGapMs` is the largest observed interval between 100 ms heartbeat callbacks. Raw observation durations are included in every sample.
9. Run `node verify-archive.ts <origin> <token-file>` for each server. It uses the real getArchivedShellSnapshot RPC and records count, distinct title count, and the first/last synthetic titles.
10. With a new pairing link, run `node capture.mjs <checkout>/apps/web <origin> <private-pair-output> <capture-output>`. This records the same interaction externally (no in-renderer screencast), then jumps to 25%, 50%, 75%, and the end of the archive. It records the mounted titles at every jump, confirms the oldest synthetic thread remains accessible, and saves top/bottom stills only after two external screen captures 500 ms apart are identical. The capture phase leaves the archive unchanged.

## Files

- before-results.json and after-results.json: all five raw measurements per side.
- before-archive-count.json and after-archive-count.json: read-only RPC checks of the full dataset.
- measurement-cdp.js: exact in-page measurement code used for both sides.
- benchmark-cdp.mjs: timing driver.
- seed-archived.ts and verify-archive.ts: synthetic RPC setup and read-only verification.
- capture.mjs: external recording and scroll verification driver.

Discarded troubleshooting attempts are excluded from the five-sample comparison. They are not evidence of the reported median. No application code was changed, and no tests are used as evidence.
