weft
ir 2.6.0 · warp 1.8.0
Part two · Step 9 of 19

A plan generated from measurement

The file tree cannot say what anything costs. Record it, and let the next build plan delivery from the recording.

Goal

Record what every region on your page actually costs, then rebuild and find that the plan changed without you editing a route — because delivery is a decision about cost.

Everything so far was declared or derived from shape. Neither can answer the one question delivery turns on: what does this region cost here, on this data, on this machine. So the framework measures it and plans from the measurement.

1 · Record a profile

sketch — not compiled
npx weft dev --profile        # exercise the pages you care about
npx weft build --profile .weft/profile.json

The profile is a file of timings per region, written by running the thing rather than by estimating it. It is an input to the build, so it is reviewable and it is diffable.

2 · Read what changed in the plan

$ weft why /  wave 1   header (buffered) · today (buffered)  wave 2   feed (stream) — p95 168 ms, over the in-order threshold  from     .weft/profile.json · 214 samples

No route changed. The plan did, because the measurement did — and the line that says so names the file and the sample count, so a plan you disagree with is a measurement you can go and look at.

A plan generated from measurement has what is recorded, what the thresholds are, and what happens on a page with no profile at all.