Skip to content

Latest commit

 

History

History
731 lines (628 loc) · 47.1 KB

performance-testing.md

File metadata and controls

731 lines (628 loc) · 47.1 KB

Performance testing for #237

Agents implementing the ERC/routing work in #237 should use this harness before and after changing a measured path. The #240 infrastructure covers CPU replay, actual rendered windows, authenticated native MCP edits and process resources. The coverage record distinguishes exercised boundaries from feature-dependent or unavailable measurements. Timing results describe one machine and build; they are evidence for choosing work, rather than portable CI pass/fail limits.

Choose a runner

For changes to the paths below, collect a baseline before implementation and repeat the affected workloads afterward with identical saved inputs and matched environments. The AGENTS.md rule and contribution guide make this part of the development workflow even after #240 closes.

Before collecting evidence, apply the verification stopping rule. State which decision the measurement will inform, the boundary it must isolate, the smallest suitable workload and the stopping condition. For example, routing job capture, cancellation and publication need measurements of those operations; a whole-editor replay supplies integration context but cannot alone attribute a slowdown to the job scheduler.

Run the selected before/after pair, then assess whether it answered that question. Noise or a comparison rejected for differing environment or window state is a limitation to preserve, rather than a reason to repeat the broad run until it passes. Further measurement needs a specific hypothesis and a test shaped to resolve it. Scope extensive statistical baselines, allocation profiles and endurance runs as qualification work instead of automatically adding them to routine feature verification.

Changed path or question Tool and instructions
Geometry queries, connectivity, DRC or validated engine commands board_perf with the CPU collection and comparison commands; the CPU example also has a browser runner
Editor input, routing interaction, painting or live MCP edits board_perf_window and browser rendered.html, with rendered replay and comparison
Memory/allocation costs, including a new index or worker implementation Add process-resource collection to the affected workload; keep profiler timings separate
Native idle/exposure behavior or the recorded Wayland stall Use the idle and presentation diagnostics and preserve failed instances for investigation
Harness correctness or ordinary CI verification Run the short harness verification; it validates replay, failure paths and saved evidence without collecting full GPU baselines

Saved inputs live under tools/performance/fixtures/, and recorded results and source fingerprints under tools/performance/baselines/. Select relevant recipes from the tables below and report raw before/after samples, their comparison, correctness results and limitations in the PR. New feature-dependent boundaries must be added with their owning implementations. Full rendered baselines, allocation profiling and endurance sessions are separate targeted runs; routine CI and unrelated/documentation-only changes do not collect them.

What the harness measures

For the #244 candidate comparison, run the engine-only example against a saved fixture, or generate separate synthetic bounds stress cases:

cargo run --locked --release -p pcbcraft-engine --example spatial_index -- tools/performance/fixtures/reference-v1.json 100 /tmp/index-reference-new.json
python3 scripts/simulate-spatial-obstacles.py /tmp/index-simulations-new
target/release/examples/spatial_index /tmp/index-simulations-new/mixed.json 20 /tmp/index-mixed-new.json

The simulator covers 64 copper layers, 4,096 tracks, 2,048 through vias, 8,192 pads and 4,000 synthetic intent tags. Analytic circular arcs and long diagonals stress conservative envelopes, including crowded curves and optional eight-piece bounds. Reports retain construction, query and replacement-query samples, candidate counts and payload sizes where available. Strategy order rotates per iteration and reverses per full cycle; execution_order records the order associated with raw sample indices. Native fixture envelopes and default probes preserve actual copper-layer membership. These measure indexing with layer filtering and deduplication, not routing, connectivity, ERC or physical presentation. Intent tags describe the fixture; the bounds lookup does not solve the electrical graph. See the retained comparison.

Enable pcbcraft-app/performance-harness to build the diagnostics. Ordinary application builds exclude them. Both native and browser CPU runners execute the same engine operations and PcbApp::frame, using the existing Craft chrome and board painting code. They do not create an eframe window or submit pixels to a GPU.

Boundary Included work
decode.cold Unpack, decode and validate a fresh production archive
connectivity.cold / connectivity.cached First lazy schematic connectivity construction / subsequent access
electrical_connectivity.first / .repeat First/repeated whole-project connectivity projection after sheet access; may clone a named graph or rebuild unnamed connectivity, so neither implies a separate project-cache hit
clearance.prepare Snapshot query preparation, including board copper connectivity and contours
clearance.pairs Current sweep candidate enumeration and represented-contour decisions
clearance.candidates.empty / .crowded Candidate enumeration in empty space / through the diagonal copper region
clearance.probe.empty / .crowded Complete disposable segment probes against an already prepared query
drc.synchronous Complete current synchronous DRC, including its own preparation
command.move_tracks Complete shared command, including validation, connectivity and history publication
replay.<step>.ui Raw egui input processing through real editor layout and shape generation
replay.<step>.tessellate CPU tessellation of those shapes; no renderer submission
replay.shared-edit.command Shared engine edit while a real route draft is pending; excludes MCP transport

Assigned-class artifacts additionally report class.route_rules.contact, class.route.request_capture, per-stage class.route.batch_max.*, class.route.engine_total and class.route.atomic_publish. Each batch metric is the maximum 256-unit service call in that iteration; the total includes all calls. The runner verifies committed width against the contacted policy and checks pair- specific probe spacing with an exhaustive oracle. Use exact saved command-generated assigned artifacts for these measurements; unassigned fixtures omit these boundaries. A pre-class-consumer revision refuses assigned operations, so their absolute costs must not be presented as a matched before/after speedup.

Cold engine samples decode a fresh project each time; the executable/WASM module stays loaded, so this means cold model caches rather than cold process startup. Replay creates a fresh app and warms fonts/layout for eight frames before measuring the trace. Logical input time advances at 60 Hz without sleeping; this measures CPU service cost and does not measure event-loop scheduling, dropped frames or actual refresh cadence. Each boundary retains all samples in milliseconds and nearest-rank p50/p95/p99/max. For a statistical latency baseline, use at least 100 samples and preferably 1,000 for a useful p99 tail. That sample guidance does not make a full statistical baseline mandatory for every change. A smaller targeted run can verify correctness and expose service costs; label its scope and avoid tail-latency conclusions that its sample count cannot support. One-sample runs are correctness/build smoke tests.

Generate and retain fixtures

To diagnose navigation in an existing native project without modifying it, use the opt-in project_perf example with the same environment metadata described below:

cargo build --locked --release -p pcbcraft-app --features performance-harness --example project_perf
target/release/examples/project_perf /path/to/project.json /tmp/environment.json /tmp/navigation-report.json

This runner uses the read-only project loader and replays eight warmup frames, then ten idle, zoom and click frames in each of the schematic and PCB editors. It checks that zoom reaches the canvas, click events are observed and authored archive bytes remain unchanged. Reports contain raw UI/tessellation CPU samples and a project hash; they do not measure GPU presentation or OS input latency. Keep the same project bytes and build profile for a before/after comparison, and qualify small sample sets as targeted service-cost checks. User projects and their libraries remain local unless redistribution is separately authorized.

For zoom-specific reports on the populated sheets and PCB editor, append --zoom-all. This separate trace uses a 2560 × 1600 viewport, eight warmup frames, ten stationary frames and thirty continuously changing zoom-in and zoom-out frames per document. Its texture_upload_bytes arrays record actual texture deltas separately from CPU timing metrics. Repeatedly alternating between two zoom sizes can hide cold font work, so this trace deliberately requests new intermediate scales and verifies that camera zoom changes on every zoom frame.

Run from the repository root using the pinned toolchain/dependencies. The actual shipping profile is [profile.release] in Cargo.toml, currently size optimized; using a different optimization profile changes the question being measured.

cargo build --locked --release -p pcbcraft-app --features performance-harness --example board_perf
# Substitute the executable's actual target directory if CARGO_TARGET_DIR is set.
target/release/examples/board_perf generate reference-v1 "$(git rev-parse HEAD)" /tmp/reference-v1.json
target/release/examples/board_perf generate dense-v1 "$(git rev-parse HEAD)" /tmp/dense-v1.json
target/release/examples/board_perf generate capacity-v1 "$(git rev-parse HEAD)" /tmp/capacity-v1.json

A small canonical artifact is also checked in at tools/performance/fixtures/reference-v1.json; reuse that file for quick shared checks and comparisons with the initial evidence. Generating a fresh artifact is useful for other workloads, but cannot be compared to those saved reports because its document identities differ.

The generator refuses to overwrite files. It uses shared commands, original bundled resistor/through-hole definitions and the production .pc encoder, with accepted schematic membership before adding copper. The JSON envelope holds the ordinary archive bytes, explicit project/board address, recipe revision, geometry seed, generator revision, project SHA-256 and pointer/key trace. It is a diagnostic artifact, not a new native project format. Do not hand-edit the embedded project.

Recipe Symbols / footprints Straight tracks Through vias Purpose
reference-v1 8 60 0 Fast harness and comparison reference
dense-v1 128 1,008 112 Mixed pad sizes, crowded long diagonals and alternating layers
capacity-v1 512 4,080 2,032 Near the former 4,096-track / 2,048-via limits

Geometry follows fixed integer patterns with recipe seed 237240. Production commands allocate UUIDs, so regenerating a recipe does not recreate identical native bytes. Retain and reuse the exact artifact across revisions and runtimes; reports hash the entire envelope, including the trace. The separately regenerated bga.* diagnostics do not use that envelope and are excluded from exact-input comparisons. Changing recipes, seeds, trace semantics or measurements requires a version change and a new baseline. Fixtures are synthetic workloads, not manufacturable reference designs. The extended recipes below add branching/channel, current hierarchy-limit and full-size ball grid array workloads. BGA routing, ERC progress and curved-routing cases still need their owning feature implementations.

route-reverse-layer-cancel-edit-v1 arms X, starts a route in empty board space, reverses pointer direction repeatedly, changes copper layer with PgDn, cancels with Escape, starts another route and injects a shared command before exiting. Every frame checks whether a draft should exist. Additional checks require the layer transition, byte-identical authored state after cancellation, one external edit and an inactive tool at completion. Missed canvas input fails the run instead of producing misleading fast samples. Shared edits exercise session revision invalidation, not concurrent transport or worker completion ordering.

route-reverse-capacity-cancel-edit-v1 replays the same steps for envelope-v1 only, where the board is already at the track and via capacity limits. Instead of requiring a layer change, PgDn must be refused with the track/via capacity message and the active layer must stay unchanged, while the cancellation, shared-edit invalidation and inactive final-tool checks remain in force.

Record native evidence

Create environment metadata using observed facts. For example:

{
  "revision": "full Git hash, with dirty diff hash if applicable",
  "hardware": "CPU model; RAM; host/VM; relevant GPU/driver when measuring presentation",
  "os": "OS release and kernel; Wayland/X11 for actual window tests",
  "runtime": "native CPU replay",
  "compiler": "full rustc -Vv output",
  "profile": "release",
  "power": "AC/battery; governor; thermal/power mode; background load",
  "notes": "test date, affinity, unknown conditions and scope limitations"
}
target/release/examples/board_perf run /tmp/reference-v1.json /tmp/native-env.json 100 /tmp/before.json
# Repeat from the candidate checkout, consuming the same artifact and metadata
# except for revision/notes. Output files must not exist.
target/release/examples/board_perf run /tmp/reference-v1.json /tmp/native-env-after.json 100 /tmp/after.json
python3 scripts/compare-performance.py /tmp/before.json /tmp/after.json > /tmp/comparison.md

Also retain git diff --binary, Cargo.lock, compiler/target versions, executable hash, commands and raw reports alongside the artifact. For measured changes, alternate before/after runs on an otherwise idle machine to reveal drift. Keep cold and warmed samples separate. Use OS profilers for allocator counts and peak resident memory; the harness does not report invented zeros for these metrics.

The comparator rejects changed fixture/trace bytes, target, sample counts, measurement IDs, warmup, geometry or environment. Revision and notes may differ. Keep a stable binary identity in notes, rather than changing the runtime label between comparable native runs. Use runtime for the runtime version/mode. Native and browser reports are separate baselines and cannot be compared as one series. If a feature needs a new boundary, apply the same measurement-only instrumentation to both revisions and document that patch; do not silently compare different code.

Budget suite for large boards

board_perf budgets runs the same CPU workloads as run on one saved artifact, also times a packed save of that project, and reports each action's nearest-rank p50/p95 next to its p95 budget when one has been proposed:

target/release/examples/board_perf generate envelope-v1 "$(git rev-parse HEAD)" /tmp/envelope-v1.json
target/release/examples/board_perf budgets /tmp/envelope-v1.json /tmp/native-env.json 20 /tmp/envelope-budgets.json
Action Boundary p95 budget
open decode.cold no target yet
save encode.packed no target yet
drc drc.synchronous no target yet
connectivity electrical_connectivity.first no target yet
move_commit command.move_tracks below 100 ms (proposed #237 commit target; track-edit proxy)
routing_input validated active-route reversal aggregate.route_reversal.ui samples below 4 ms (proposed #237 routing-input target; CPU service-cost proxy)

Open, save, DRC and connectivity have no agreed target, so the suite reports their quantiles with the verdict no budget. The two budgeted rows use the proposed #237 gates (see Agent acceptance instructions) and are strict: each action gets measured pass (p95 below budget), measured miss (p95 at or above budget), unmeasured (its boundary recorded no samples) or no budget. A missing boundary never counts as a pass. Each row carries a budget_basis saying where its target comes from and what its boundary can certify. routing_input is the CPU service-cost proxy described there, so a pass certifies neither the window's routing-input budget nor either visible-preview budget (p95 < 16.7 ms / p99 < 33 ms); move_commit times a validated track edit and does not qualify walkaround or shove commits. The report lists the window routing-input budget, the visible-preview budget, process memory, a 10,000-object agent change and multi-core speedup as unmeasured. The timed save must reopen with equivalent project contents and a valid manifest, while the report retains the original input archive hash; that check runs outside the timed boundary. open covers unpacking, decoding and validating the archive, not process startup or the file dialog. A verdict describes one machine and build; like other timings here, it does not gate CI. The first iteration checks clearance pairs against the exhaustive reference, so envelope-size runs take much longer than the timed boundaries alone.

Local regression gate

scripts/check-performance-regression.py compares two matched pcbcraft-performance-budgets/1 reports on Linux, Windows or macOS and fails when any action's nearest-rank p95 regresses by more than 20 % (configurable with --max-regression-pct):

python3 -B scripts/check-performance-regression.py /tmp/budgets-before.json /tmp/budgets-after.json

The script validates every raw sample and recomputes each action's quantiles and verdict from metrics, and refuses confounded environment, artifact, project, iteration or geometry mismatches. A metric may hold more samples than there are iterations: routing input pools every reversing route pointer move of an iteration into one aggregate metric. An action unmeasured in both reports (for example routing input on a trace that never reverses a route) is not compared and is listed as such in the report and in --json output (not_compared). An action measured in only one report, or with different sample counts, makes the reports incomparable, and so does a pair with no action measured in both. A change of exactly the threshold passes; the comparison ignores floating-point excess below 1e-9 percentage points. It exits 0 when every compared action stays at or below the threshold, 1 when any action regresses (naming each regressed action in the report and in --json output), and 2 on invalid or incomparable reports. Shared-runner CI still collects no performance samples and enforces no wall-clock threshold; running this gate in three-platform CI (Linux, Windows and macOS) on dedicated hardware is a maintainer decision tracked under #237.

Property-edit service-time diagnostic

property_edit_perf in pcbcraft-engine measures synchronous shared property commands on an original 8- or 128-part schematic. Build that example in the same profile at both revisions, applying the same measurement-only source to an older revision that lacks it. Generate each artifact once and reuse its exact bytes:

cargo build --locked --release -p pcbcraft-engine --example property_edit_perf
target/release/examples/property_edit_perf generate 8 /tmp/property-8.pc
target/release/examples/property_edit_perf generate 128 /tmp/property-128.pc
target/release/examples/property_edit_perf run /tmp/property-128.pc 100 /tmp/property-after.json

Retain environment metadata, source patch, compiler/profile, executable and revision hashes with the artifact and raw JSON. The fields boundary is the same reference edit on both versions. lock and preview are measured only when the command catalog exposes designator locks; their absolute costs are not a matched speedup over an implementation that lacks them. Use artifacts produced by this example; its count/shape checks do not authenticate their provenance. Each boundary uses eight warmup calls (preview calls do not edit), retains all samples, and checks the exact real-Apply document delta and rollback or preview non-mutation outside the timed command. The opened input uses the production cap+1 reader. Reports include the archive hash and nearest-rank distributions, with no CI timing threshold. A targeted run through a busy build queue records elapsed synchronous service time, not isolated CPU cost or a machine latency baseline. Outputs are exclusively created, never replaced; a failed write may leave a partial new artifact or report. Live MCP transport, UI frames and rendering remain explicitly unmeasured by this runner.

Oversized schematic connectivity diagnostic

To measure one synchronous connectivity-changing edit above the schematic wire and label caps, run this focused Engine test on the revision under review:

cargo test --locked --release -p pcbcraft-engine --lib \
  schematic::capacity_tests::connectivity_timing::delete_wire_rebuilds_connectivity_on_an_oversized_sheet -- --exact --nocapture

The test creates a synthetic, in-memory sheet and times one ordinary schematic.delete_wire transaction per fresh session using the same starting snapshot. It verifies that the branch pin disconnects and the trunk stays connected. The starting fixture deliberately skips count admission; it cannot be opened from disk at the current caps. The deletion brings the wire count back to the cap, and the edit path and shipping limits are unchanged. The timer excludes fixture construction, session opening, and the post-edit checks. Keep the reported counts, five raw release samples and median, CPU model and core count, compiler/profile, and exact revision. This is command service time, not file-open, MCP transport, or rendered latency. CI checks correctness without a wall-clock cutoff.

Record browser evidence

The browser diagnostic is a separate opt-in WebAssembly example, without changing the shipping web launcher. Use the wasm-bindgen CLI version matching Cargo.lock. It needs a real browser Window, not Node/WASI.

rustup target add wasm32-unknown-unknown
cargo build --locked --release -p pcbcraft-app --features performance-harness --example board_perf_web --target wasm32-unknown-unknown
wasm-bindgen --target web --out-dir tools/performance/pkg target/wasm32-unknown-unknown/release/examples/board_perf_web.wasm
# Match the shipping Trunk postprocessing (data-wasm-opt="z"); record tool versions.
wasm-opt -Oz --enable-bulk-memory --enable-nontrapping-float-to-int tools/performance/pkg/board_perf_web_bg.wasm -o tools/performance/pkg/optimized.wasm
mv tools/performance/pkg/optimized.wasm tools/performance/pkg/board_perf_web_bg.wasm
cp /tmp/reference-v1.json tools/performance/fixture.json
cp /tmp/browser-env.json tools/performance/environment.json
python3 -m http.server 8782 --bind 127.0.0.1 --directory tools/performance

Visit http://127.0.0.1:8782/?artifact=fixture.json&environment=environment.json&iterations=100. Save the displayed JSON, or obtain globalThis.performanceReport through browser automation; globalThis.performanceError signals a failed run. Record browser name/full version, headless/headed mode, flags, timer precision/isolation settings, OS/hardware/power conditions, WASM/glue hashes and build commands. Browser timer resolution can quantize very short samples to zero, so retain those raw samples and avoid percentage conclusions when the baseline is zero. Use a fresh tab for cold module startup studies; module download/startup is outside these boundaries. The synchronous diagnostic occupies its tab while running and is not an example of responsive background execution.

Agent acceptance instructions

Before implementing #243, #244, #246, #247, ERC or related #237 work, read the owning issue and this guide, then record a baseline for the affected fixtures on available native and browser targets. Preserve the saved artifacts for the PR. Run the same suite afterward and explain both improvements and regressions. Correctness assertions are mandatory even when timing gets better: compare query findings with the exhaustive reference, reject stale authority and retain the feature's own cancellation/rollback tests. The harness checks current query contact/violation completeness against all pairs outside the timed boundary on the first iteration for boards up to 8,192 objects; above 8,192 objects, it compares the findings touching a deterministic 128-object strided sample against an exhaustive per-object reference. Every disposable probe also compares contact, clearance and conflicting-membership findings against an exhaustive shared-layer contour and membership reference outside its timed boundary. These guards do not replace a feature's exhaustive correctness suite.

The proposed #237 targets are routing-input p95 < 4 ms, input-to-valid-visible-preview p95 < 16.7 ms / p99 < 33 ms, cancellation by the next rendered frame and commit p95 < 100 ms with responsive preparation. The comparator lists CPU frames whose p95 reaches 4 ms as candidates for investigation. A CPU frame below that value cannot certify the window's input budget or either visible-preview budget. command.move_tracks can expose an expensive validated edit, but is not proof that a future walkaround/shove commit meets its target.

For each budget, report measured pass, measured miss or unmeasured, with the actual boundary, fixture, profile, sample count and tail distributions. Do not turn missing measurements or unsupported features into passes. A useful PR report contains the before/after revisions and artifact hashes, environment, comparison, correctness results, identified misses and remaining gaps. Explain why the measured operation represents the changed feature. Keep the owning feature or qualification issue open for its incomplete acceptance work; completing the reusable harness does not qualify unimplemented features.

When adding jobs (#243), extend the harness with queue length, coalesced/replaced requests, preparation/publication time, cancellation acknowledgement and stale completion counts. Exercise continuous input, cancellation, layer/rule/board/opening changes, overlapping MCP edits, queue saturation, worker failure and shutdown. When adding an index (#244), retain the current exhaustive oracle and measure cold build, ordinary updates and disposable overlay queries using identical artifacts; record memory and allocation costs before selecting an implementation. Walkaround and shove need their own valid-preview/commit traces, reversal and rollback cases. ERC can reuse the symbol/hierarchy-limit recipes added below, but still needs progress/cancel coverage with its implementation. Worker and indexed-query capabilities are not supplied by this harness.

Actual end-to-end claims require a rendered native/browser window and instrumentation at input receipt, valid preview acceptance, frame submission and presentation, with clock domains explained. Add GPU/driver/renderer metadata and presentation/frame traces. Cover Windows, macOS and Linux where available; identify unavailable systems explicitly. On Linux read the workspace record setup/2026-11-11-wayland-freeze.md before native performance/endurance work. It is outside this Git repo, under the PCBcraft workspace root. Include long idle, occlusion/workspace switching, lock/unlock, display sleep/wake and monitor changes, with a matched X11 run where available. Short CPU replays do not investigate or resolve the reported overnight Wayland redraw stall.

Harness verification

cargo test --locked -p pcbcraft-app --features performance-harness performance::
cargo clippy --locked -p pcbcraft-app --features performance-harness --all-targets -- -D warnings
cargo check --locked -p pcbcraft-app --features performance-harness --example board_perf_web --target wasm32-unknown-unknown
python3 -B -m unittest discover -s scripts -p 'test*performance*.py'
node --no-warnings --experimental-vm-modules --test scripts/test-performance-page.cjs scripts/test-rendered-performance-page.cjs

Run the repository's ordinary required checks as well. CI smoke tests establish artifact/replay correctness; shared-runner timings are not accepted performance baselines and no machine-dependent wall-clock threshold gates CI.

Rendered native and browser replay

board_perf_window and the browser's rendered.html open the production editor through eframe and submit its geometry to the GPU. They consume the same saved artifact and assert route start, reversals, copper-layer change, cancellation without authored changes, stale-draft invalidation and an inactive tool at exit. Native replay sends the shared edit through a real authenticated loopback MCP connection while the window continues painting. Browser replay uses the shared engine command because the browser has no native MCP endpoint.

cargo build --locked --release -p pcbcraft-app --features performance-harness --example board_perf_window
# ENVIRONMENT_JSON must identify the window system, GPU/driver, compositor and power conditions.
target/release/examples/board_perf_window tools/performance/fixtures/reference-v1.json /tmp/window-env.json 100 /tmp/window-report.json
python3 scripts/compare-rendered-performance.py /tmp/window-before.json /tmp/window-report.json

The diagnostic window uses fresh presentation state, does not restore or save user settings and never saves its synthetic project. It requests an exposed, fixed 1400×900 window. Close before completion is a failed run. Native runs need an available display and loopback sockets; use an isolated display when needed and identify software adapters/virtual displays in the environment. A software or virtual-display result is not a hardware/compositor baseline.

For the browser, rebuild board_perf_web with the existing WASM instructions, serve tools/performance, and open:

http://127.0.0.1:8782/rendered.html?artifact=fixtures/reference-v1.json&environment=environment.json&iterations=100

backend=gl explicitly selects wgpu's WebGL backend; the default retains eframe's normal selection. Keep backend, browser, flags, CSS viewport, device scale and headless/headed mode identical in comparisons. A failed WebGPU run cannot be silently relabeled as a passing WebGPU baseline after selecting WebGL. Retrieve globalThis.performanceReport or the visible JSON. performanceError is a failed run; cancelPerformanceReplay() releases the runner without returning a report.

The rendered report has its own schema and comparator. Each boundary retains raw samples and nearest-rank p50/p95/p99/max:

Boundary Observed interval
rendered.<step>.ui Production app input handling, layout and shape generation
rendered.<step>.input_to_ui Synthetic framework input injection through completion of that app pass; the native shared-edit step also includes transport waiting
rendered.<step>.input_to_gpu_readback Injection through native screenshot callback, or browser canvas pixel readback after frame submission
rendered.<step>.readback_delivery Pixel availability through consumption by the next UI pass, including hashing and delivery/scheduling delay
mcp.roundtrip Native authenticated socket request through its complete reply

Press/release pairs are delivered atomically in the rendered runner, unlike the CPU runner's separate logical frames. GPU readback must not stretch a click into a long press. Actions are paced at no more than 60 Hz, using the real framework clock; reports record this input policy, so these measurements cannot be compared to a different injection policy. One accepted UI pass corresponds to one sample. Input batches remain pending across logic-only callbacks until an accepted UI pass consumes them; an obscured/temporarily unpainted window must not erase a click. The original artifact remains unchanged. Images must have nonzero, stable physical dimensions and varying pixels; raw callback deadlines, dropped callbacks, state assertion failures and renderer shutdown never produce passing reports. The browser page also bounds module import, WASM initialization and renderer startup to 30 seconds each, destroying a runner that arrives after its deadline. Native startup and accepted UI progress are monitored by a separate 30-second watchdog. Intentional idle holds extend that deadline; a stalled event loop cannot hide failure merely by preventing its in-app timer from running. Watchdog expiry normally exits this diagnostic process with an error and no report. Browser host polling likewise rejects 30 seconds without accepted UI progress, independently of the app's animation callbacks.

Only one screenshot is outstanding. Native mapping completion is serviced by a nonblocking Device::poll(PollType::Poll) worker at a 1 ms interval while that capture is pending. It stops on completion, cancellation or timeout; the UI never joins it or waits on a socket. Browser readback copies the submitted canvas in a microtask before the drawing buffer may be discarded. Image-copy and mapping costs are included in the readback boundary; hashing follows its timestamp. The renderer and last image digest are retained with capture counts and dimensions.

These are rendered readback measurements. They include instrumentation costs and do not observe physical input arrival or the compositor's presentation time. A readback budget miss is evidence about this boundary, not proof of a visible preview miss. Do not promote a CPU pass or a GPU readback pass to an input-to-photon claim. Native and browser clocks remain separate monotonic domains.

Extended workloads and process resources

The following original command-generated recipes extend the existing artifacts:

Recipe Supported coverage
board-limits-v1 Exactly 4,096 tracks and 2,048 vias, the board limits when it was recorded, with 512 footprints; the older capacity-v1 artifact stays unchanged
channels-v1 64 footprints, mixed widths/pad sizes, 410 tracks, through vias, two narrow parallel rails and 48 attached branches
hierarchy-v1 The current 64-sheet limit, 63 explicit child links, shared global labels and one symbol per sheet
schematic-limits-v1 The current 4,096-symbol / 64-sheet limits; eight physical footprints and explicit board exclusions for the other schematic parts
bga-v1 The reference-v1 board plus one 32 x 32 ball grid array at the 1,024-pad, 256-artwork and 1,024-terminal limits, loaded as a native library and placed with all eight symbol units and the full terminal map. After all fixed-artifact samples, a separate pass times library load, part, unit and footprint placement, baseline capture, packed encode and decode, and the design check of a fresh project holding only the array (bga.* metrics). The fresh BGA-only subcase has no routing; the retained reference-plus-BGA artifact has the reference tracks and standard replay
envelope-v1 Board at the current 65,536-track, 16,384-via and 1,024-pad BGA limits built through shared commands: 65,536 tracks, 16,384 vias, 512 footprints (chosen to match board-limits-v1, not a limit: 511 discrete resistors plus one 32 x 32 ball grid array at the 1,024-pad, 256-artwork and 1,024-terminal limits) and a closed board outline, staying within the 16 MiB document and 64 MiB packed archive limits; uses route-reverse-capacity-cancel-edit-v1, seeded geometry and counts, generated on demand rather than checked in

Generate with board_perf generate RECIPE REVISION ARTIFACT, retain the exact artifact, then reuse it across runs. The bga.* diagnostics are generated from each checkout after fixed-artifact replay and are not identified by the artifact hash. Keep them as single-run diagnostics unless a separately pinned workload is available; the exact-input comparator ignores them when matching measurement boundaries or computing deltas. CPU reports distinguish sheet-local connectivity from project-wide electrical connectivity and include a channel probe checked against the exhaustive contour reference. BGA fan-out and high-pin-count routing remain owned by #253, and curved tracks by #259–#262; straight-track fixtures do not qualify unsupported geometry or routing features.

Collect process memory without adding an allocator to production Rust:

python3 scripts/collect-performance-resources.py target/release/examples/board_perf tools/performance/fixtures/reference-v1.json /tmp/native-env.json /tmp/reference-resources --iterations 100 --allocations

The output directory must not exist. The collector records executable/artifact hashes, commands, raw timings, 10 ms Linux RSS samples and observed process high water where available. --allocations additionally uses an installed Valgrind for a separate one-iteration whole-process allocation count. Its timings have profiler overhead and are explicitly named profiled-timings-not-a-baseline.json. Missing process counters remain unavailable, and missing profiler totals fail collection rather than turning into zeros. These measurements include startup, decoding, correctness oracles, fonts and reporting; they are not isolated index allocation costs. Collection is bounded by a deadline and terminates only its own child on failure. Preserve both successful evidence and failure logs.

Idle and presentation diagnostics

Native replay can hold the same window between complete traces:

target/release/examples/board_perf_window tools/performance/fixtures/reference-v1.json /tmp/wayland-env.json 2 /tmp/idle-report.json --idle-seconds 28800 --preserve-on-stall

The report records the requested idle interval and actual total elapsed time. A short hold verifies the mechanism; it does not establish eight-hour endurance. Use --preserve-on-stall for an endurance investigation: the independent watchdog reports failure and the diagnostic PID while preserving the process for stacks and protocol investigation. Even if it later recovers, it cannot write a passing report. End only that diagnostic after collecting evidence. Automated smoke runs should omit this flag so failure exits promptly. Diagnostic logs timestamp injected actions and their checked app state. For an isolated Wayland run, WAYLAND_DEBUG=client also records protocol frame callbacks, configure/visibility traffic and surface commits. Retain those logs with the exact executable hash and environment, explaining clock alignment before comparing protocol timestamps with the harness's monotonic milliseconds. Do not enable protocol logging on an unrelated user's editing instance.

Follow the workspace's freeze record for occlusion, workspace switching, lock/unlock, display sleep/wake and monitor transitions. Record each transition and whether painting and File/resize input recover. Replay intentionally owns its inputs and synthetic project; an ordinary editor endurance session is also needed to qualify normal manual interaction. Preserve a stalled process and collect its stacks and traces before recovery. The harness does not claim to fix the recorded Wayland stall.

Feature-dependent queue lengths, coalescing, stale completions, index updates, ERC progress and walkaround/shove commits must be instrumented with #243–#247, #47 and the corresponding feature PRs. This infrastructure supplies reusable artifacts, comparisons, rendered replay and resource collection; it cannot measure implementations that do not exist. Record Windows/macOS coverage as available or unavailable instead of inventing cross-platform results.

Checker job measurements

For #243's first checker slice, the CPU diagnostic also accepts checks:

target/release/examples/board_perf checks /tmp/channels-v1.json /tmp/environment.json 100 /tmp/checker-jobs.json

The browser CPU page selects the same diagnostic with &checks=1. The pcbcraft-checker-performance/1 report records capture, stage/batch service costs, engine total time, queue polling and cancellation acknowledgement, with raw samples and report-equivalence assertions. A work batch considers at most 256 contact/clearance/courtyard pairs or outline items. Footprint projection uses at most 32 placements per batch; remaining membership, dimension and finalization phases yield at phase boundaries and retain supported model/report bounds. Browser execution yields between batches after a nominal two-millisecond allowance; this is a cooperative scheduling target, not a hard upper bound on a linear phase or a geometric predicate. Retain measured overruns rather than reporting that allowance as achieved latency.

Each view retains one running check and at most one replaceable pending snapshot. Native execution has a process-wide limit of two snapshot workers shared by checking and copper preparation; excess starts fail with a capacity error. The live MCP endpoint retains at most one deferred check and refuses another until the slot retires. Canceling revokes publication immediately; worker acknowledgement occurs after the current batch. Neither closing a view nor application teardown joins a checker thread.

These new metrics are checker CPU/queue boundaries, separate from the established CPU and rendered reports. Compare the existing reports with their existing comparators, and retain the new report separately. Its synchronous browser collector does not demonstrate a responsive window; real editor frames and the rendered replay remain required for interaction claims. The routing continuation adds board_perf routes ARTIFACT ENVIRONMENT ITERATIONS REPORT and &routes=1 on the browser CPU page. Its separate pcbcraft-route-preparation-performance/1 report measures source/request capture, resumable stages, publication, replacement and cancellation acknowledgement. It asserts exact saved-byte equivalence with the synchronous shared command, one revision per commit and stale-source rejection. The ordinary replay remains the matched before/after measure for pointer reversals, layer transitions, cancellation and concurrent MCP edits; these diagnostics do not establish presentation latency.

The #246 walkaround solver adds board_perf walkaround ARTIFACT ENVIRONMENT ITERATIONS REPORT. Its separate pcbcraft-walkaround-performance/1 report times complete plans over a captured query and requires identical plans on every iteration; first plans are committed through pcb.add_tracks against the exhaustive pair reference. See walkaround route planning. It measures solver service cost only; route-tool preview and commit latency need the tool integration.

Copper preparation uses the same two-worker process limit and incremental browser logic as checking. Each view retains one running job, one coalesced desired input, one ready candidate and one immutable source context. Pad projection survives pointer replacement while the source remains current. Capturing does not encode project files. Candidate construction and final shared history publication remain linear phases with supported model bounds; their measured costs are reported separately rather than hidden by the browser polling allowance.

The route's source covers session identity, project opening, physical board, revision and immutable rules/geometry. The host additionally checks view/input epoch, request generation, active layer and local dimensions. An opaque prepared edit can publish only once through Session::commit_copper_edit; stale edits, reopening and Undo/Redo revoke it. GUI copper gestures and size properties defer preparation. Headless callers drain the same engine job synchronously. Live MCP retains one deferred copper request, rechecks its deadline, endpoint/Assistant turn and modal ownership before publication, and cancels observed disconnects. The socket worker samples disconnects at up to 20 ms intervals; no distributed check can eliminate a disconnect racing an already authorized transaction.

Pending route geometry uses the existing chrome adapter's ghost styling and progress appears in the board status. Escape and right-click cancel final preparation; navigation runs before the gesture input gate. Prepared status means the existing command's contact/lock checks passed, with clearance enforcement and walkaround/shove still owned by their subsequent issues. ERC jobs remain with the ERC feature. These checks do not qualify Wayland endurance/presentation latency.

board_perf pointer_latency ARTIFACT ENVIRONMENT_JSON ITERATIONS REPORT exercises continuous pointer updates in native production frames and snapshot workers, paced at 60 Hz. It inspects whether the actual preview copper reaches each new target in its input frame, then confirms that cancellation preserves authored bytes. This native-only diagnostic accepts 1–20 repetitions and retains UI service samples; it does not measure GPU/compositor presentation. Its saved before/after evidence records the frame-handoff regression and the additional bounded work on the UI thread separately.

board_perf commit_fixture ARTIFACT OUTPUT derives the versioned route-contact-commit-history-v1 trace while preserving the saved project's bytes and hash. Run it through board_perf_window or the browser rendered page. The first saved airwire with conductive pads at both ends supplies the contacts; legacy center-only markers are excluded without consulting solver outcomes. The trace waits for a fully validated preview, clicks a different final target, and records input-to-publication UI and GPU-readback intervals. Full DRC, one-step Undo/Redo, and exact native reopen run outside the commit interval.

For via displacement and connected D-drag, use the two saved #248 fixtures and board_perf shove ARTIFACT ENVIRONMENT_JSON ITERATIONS REPORT. The ordinary shove fixture exercises the original single, cascade, branch and lock cases. The joint fixture moves a through via with tracks on both layers, then starts a fresh session and drags a connected pair into an unrelated rail. To make a new joint fixture, run board_perf shove_joint_fixture SHOVE_FIXTURE GENERATOR_REV OUTPUT once and retain the resulting native project bytes for later comparisons. The #248 evidence includes both saved inputs, raw reports, build hashes and the geometry and history checks.

board_perf held_drag_fixture JOINT_FIXTURE OUTPUT reuses the #248 joint board with the versioned held-track-drag-preview-cancel-commit-v1 trace. Run it with board_perf_window or the browser's rendered replay. The trace holds a segment, waits for the displayed validated shove, cancels once, then releases and verifies one edit. The final check compares the moved joint and displaced rail against the source, checks clearance, and exercises exact Undo/Redo and native reopen.