# PDF first-page measurement

The final series is runs 6–10 (five alternating pairs), on one Windows Server 2025 lease with headless Chromium. Runs 1–5 were preliminary; the final series corrects the synthetic PDF's content-stream length. File sizes and image content are unchanged. Only the final series is included in the uploaded measurements.

Base: [834eb51301](https://github.com/pingdotgg/t3code/commit/834eb51301a447e6f4a8f5f517fb4eb75e00a783).
Head: [abdcc82bcb](https://github.com/pingdotgg/t3code/commit/abdcc82bcbce4ef2436458cd5a9caa56b082b7a8).

## Reproduce

1. Prepare each checkout independently with `vp i`. The startup helper expects `pdf-base` and `pdf-head` beside the main `t3code` checkout, under the Windows user's home. It launches each app with `T3CODE_DEV_SEED=0`, its own worktree state, and a locally generated reusable dev credential.
2. Put the scripts in a synthetic scratch folder `C:\pdf-proof`. Run `seed.py` with Python and Pillow; put the generated PDFs into its `fixture` subfolder. Initialize that folder as a Git repository and commit the files. The uploaded PDFs are the exact fixture bytes used, avoiding any Pillow encoder version differences.
3. Run `powershell -File start.ps1 base` and `powershell -File start.ps1 head`. Read each app's real web port from its local app log. Wait until its environment endpoint responds successfully. Do not upload the logs or token files.
4. For each pair, run `node measure.mjs base http://localhost:<base-port> <n>`, then the identical command for `head`, with n=6 through 10. The driver uses the installed Playwright package in the main checkout and Chromium headless-shell revision 1248.

Every run creates a new browser context (1440×900, device scale 1, dark theme), authenticates it, opens the project draft through Add project → Local folder, opens the right panel and Files, clicks `small.pdf`, and waits for its page-one canvas to contain non-white pixels. It clears the browser cache, applies CDP download/upload throughput 625,000 bytes/sec and latency 120 ms, then clicks `big.pdf`. The clock starts in the actual row's click listener and ends on the first animation-frame observation of a new Page 1 canvas containing opaque non-white pixels. The PDF tree uses shadow DOM; the driver targets `data-item-path`.

CDP records asset requests, Range headers, status, Content-Range, and decoded payload bytes received up to that observation. Signed URLs and credentials are omitted. A cancelled initial StrictMode request can appear with zero bytes and no status.

After the timed measurement, throttling is removed. The driver captures the completed first canvas, its raw PNG hash, and a still after consecutive screenshots 500 ms apart match. These checks and captures are outside the timing interval. `collect.ps1` gathers only final runs; `report.py` produces the text report, summary JSON, and chart directly from their measurements.

`encode.py` selects each side's median run and produces real-time recordings trimmed to include the small-PDF selection and the timed big-PDF click, cropped to the PDF/Files panel, with an environment/commit label above it. No time scaling is applied. This crop keeps unrelated chat UI and machine labels out of the public capture. The app viewport and panel dimensions are identical on both sides.

The project display labels differ (`fixture` / `PDF benchmark`); both refer to the same synthetic Git repository and exact PDF bytes. No agent turn or model is needed to preview the files. The replay timing scenario runner was not used because its documentation explicitly excludes performance timing.

Synthetic big.pdf SHA-256: `c4579188112a7c67805ca8c1a895613c484e7c183152b907fd03dc0437837360` (14,900,532 bytes, 40 image pages, cross-reference table at end).
Small.pdf SHA-256: `f9230c3dce3a6f5d8d7d03a9bb1bce40ca3ccbb4e4440d781ac1486485a81bea` (372,640 bytes).
