# Measurements

Readings behind `docs/impact.md`, one folder per rig and one file per run (`<date>.json`, or
`<date>-<experiment>.json` when a rig ran more than one experiment that day). Every reading here is
L1, measured on hardware described in the file.

| rig                | measures                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | instrument                                 | script                                |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ------------------------------------- |
| `repeat-nav`       | bytes and requests of cold, warm and repeat views on 16 public sites                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Chromium DevTools Protocol                 | `scripts/measure/repeat-nav.ts`       |
| `on-wire`          | the same navigations, with the requests and bytes a proxy saw reach the origin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | a counting proxy and Chromium DevTools     | `scripts/measure/on-wire.ts`          |
| `zero-network`     | server hits per service-worker navigation in Chromium, Firefox and WebKit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | the origin's request log                   | `scripts/measure/zero-network.ts`     |
| `device-cpu`       | browser CPU per navigation, HTTP revalidation vs a service-worker render                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | process CPU time (a proxy, not joules)     | `scripts/measure/device-cpu.ts`       |
| `rapl`             | package joules on a desktop CPU, by experiment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | RAPL energy counters, a sampled GPU        | `scripts/measure/rapl.ts`             |
| `iphone`           | phone joules per view, back to back and paced; service-worker lifetime                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | the battery gauge's accumulated energy     | `scripts/measure/iphone.ts`           |
| `payload`          | compressed bytes of a page, its shared shell, its unique part and its node data                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | plain GETs, gzip, brotli, zstd             | `scripts/measure/payload.ts`          |
| `trim`             | CSS and JS used per page, new aggregate bytes, markup classes, bytes by class                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Chromium coverage and DevTools, zstd       | `scripts/measure/trim.ts`             |
| `link-assets`      | icon, manifest, tile and video requests per navigation, by headers and worker                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | the origin's request log, worker log       | `scripts/measure/link-assets.ts`      |
| `image-crawl`      | image, video and iframe bytes per first view, WebP arms with SSIM, lazy loading                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Chromium DevTools, tinyimg, canvas SSIM    | `scripts/measure/image-crawl.ts`      |
| `dictionary-size`  | stylesheet and script bytes per first view against a dictionary, four ways to choose it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | node:zlib zstd and brotli, brotli CLI      | `scripts/measure/dictionary-size.ts`  |
| `nav-replay`       | accuracy and net joules of seven provisioning arms replayed on public page-category sequences                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | replay of a public dataset (UCI 133)       | `scripts/measure/nav-replay.ts`       |
| `first-payload`    | requests and bytes from a first controlled visit to the first local view, artifact fetched, derived or inlined                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | request log and HTTP text sizes, Chromium  | `scripts/measure/first-payload.ts`    |
| `embed-markup`     | embed iframes, videos and provider scripts in the server-rendered markup of 60 sites                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | plain HTTP GETs and a tag tokenizer        | `scripts/measure/embed-markup.ts`     |
| `dataset-baseline` | response bytes, route loads, sync bytes and native HTTP revalidation bytes of a held collection after a change, 50 to 5000 rows                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | in-process createSpool and node:zlib       | `scripts/measure/dataset-baseline.ts` |
| `avoidable-loops`  | per-second frame, timer, request, video and animation counts of a visible and a hidden window on 60 public sites                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Chromium over raw CDP, page-side counters  | `scripts/measure/avoidable-loops.ts`  |
| `storage`          | pack wire bytes, bootstrap and view time, and storage growth of the packed store at 1,000 to 100,000 rows; the rig runs Chromium, Firefox and WebKit, the committed reading covers Chromium and Firefox                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Playwright, `navigator.storage.estimate()` | `scripts/measure/storage.ts`          |
| `demand`           | requests and bytes per reader model, with spool and without, on a local site. `2026-11-20-single.json` covers one, two and five views, a 121-view mix and a 2,000-view tab in Chromium and Firefox; `2026-11-20.json` is superseded by it. The `-days-ship-a` file covers daily, local-only and public-edit readers, `-ship-b` the signed-in reader with session retention, and `-ship-c` the signed-in reader with the default persistent retention and the revoked session, over one to five days. They are Chromium only, because Firefox did not start the multi-day arms under libfaketime. `-days`, `-days-views` and `-days-principal-edit` ran on an earlier tree and are superseded | the origin's request log, Playwright       | `scripts/measure/demand.ts`           |
| `examples`         | requests, handler invocations and bytes at 1, 2, 3, 10 and 100 views of each example site, with spool and without, in Chromium and Firefox                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | the handler's request log, Playwright      | `scripts/measure/examples.ts`         |
| `static-host`      | Worker invocations, asset requests and bytes per visitor over the first three views, 121 read views, five lease periods and a publish, in Chromium and Firefox; four arms: no spool, worker only, static files with a stamp, and static files without one                                                                                                                                                                                                                                                                                                                                                                                                                                    | Worker counter, a proxy, Playwright        | `scripts/measure/static-host.ts`      |

The `rapl` experiments are `views` (optimized caching, spool and shipping headers), `compute-server`
(recompute against a cache, per request), `compute-browser` (the same in Chromium), `projection`
(a result computed on the server or in the page), `inference` (a local model, with the GPU board
sampled), `power-state` (request rate against package watts) and `sw-request` (one `fetch` answered by
the browser cache, a worker, a 304 or a 200), `idle-activity` (a quiet page, a 1 Hz poll and a
`requestAnimationFrame` loop, per minute), `idle-activity-tabs` (one tab, three tabs polling, three
tabs with one leader polling, three quiet tabs, and one tab hidden for 330 s, per minute), `image-decode` (an image decoded from the original, a
WebP at native size and a WebP at the rendered width), `image-encode` (tinyimg conversions with a
warm and a cold module), `dictionary-load` (one aggregate file delivered as brotli or as `dcz`) and
`first-view` (a cold first view of each recorded page, and its facade arm where an iframe changes;
it runs against a corpus from `scripts/measure/first-view.ts record`), `first-view-warm` (a repeat
view of the same pages: the second navigation in a context whose cache the first one filled; the
same corpus), `chunk-split` (the same synthetic JavaScript served as 1, 5, 25 and 50 scripts, each
brotli-compressed on its own, at 0 and 40 ms emulated delay), and `drupal-render` (one
generated Drupal 11 site, per request: an uncached render, a warm render cache, the page cache, and a
null route; it runs against the origin built from `scripts/measure/drupal/`).
A `rapl` row holds the window's `otherCpuMs`, and a derivation drops a window over 100 ms of other
containers' CPU per second; `idle-activity` also drops a round whose idle windows disagree by more
than 25%. The `iphone` experiments are
`burst`, `paced`, `projection` and `sw-lifetime` over Wi-Fi, and `burst-cellular`, `paced-cellular`
and `radio-cellular` (one isolated request against the same script call without it) over cellular.
The `repeat-nav` experiment `document` records where each document landed after redirects, and
`requests` adds a `requestList` to each home repeat view: one record per request (URL without its
query, host, same-origin flag, type, status, bytes, which cache answered, and the response's
`cache-control`, `age`, `vary` and `content-type` with `etag`, `last-modified` and `expires` as
present or not), plus the document's `docRedirects`.

## File Format

Each file is one JSON object:

| field                               | contents                                                    |
| ----------------------------------- | ----------------------------------------------------------- |
| `schema`                            | format version, currently `1`                               |
| `rig`, `date`, `layer`              | which rig, the run date (UTC), the evidence layer           |
| `question`                          | what the run answers                                        |
| `instrument`, `machine`, `software` | what read the numbers and what they were read on            |
| `method`                            | windows, rounds, arm order, pacing and any emulation        |
| `exclusions`                        | rules for rows a reader must drop, with the reason          |
| `rows`                              | one object per window or navigation, as the rig recorded it |

Rows carry raw quantities (joules, seconds, navigations, requests). Per-view figures are derived
from them by `scripts/impact.ts`, never stored here. `src/report/measurement.ts` holds the type and
the reader, and a test reads every file in this folder through it. A file must not carry a device
id, a container id or an address other than loopback.

A script writes its file with `--out` set to this folder by default and refuses to replace a file
that exists unless `--force` is given. Run `bun run prettier` over a new file before committing it.
