Skip to main content

Module bench

Module bench 

Source
Expand description

Reference routes for the bench subcommand: a fixed set of positions in Slovenian and Italian waters, checked against a real chart on every run, for measuring the effect of a change to route-find’s search or its caches.

Every position is verified against a real chart as open, safe water – a reference case sitting on a rock or in charted shallows would only prove itself broken, not detect a regression. A zero-length enc-check leg --from P --to P probe cannot verify a candidate point reliably: a degenerate leg has no corridor band for check_leg to test, so it reports “nothing found” for any position, land included. Instead, each candidate point is checked with a short real leg (a tenth of a nautical mile) in a few directions; route-find’s own Hazards::blocked (private to that crate) tests a small square around the point directly, without this gap.

Structs§

BaselineEntry
One ReferenceRoute’s own previously measured result, against which bench compares a later run’s own result to decide whether it regressed – see distance_regressed and time_regressed.
ReferenceRoute
One route bench measures on every run: a name, and the two positions [route_find::find_route] searches between.

Constants§

DISTANCE_REGRESSION_FLOOR_NM 🔒
The absolute floor distance_regressed applies alongside DISTANCE_REGRESSION_RELATIVE, in NM, so a short hop’s own tiny baseline (the two short Gulf of Trieste cases measure a bare 3-4 NM) does not make one percent tighter than floating-point noise can actually promise.
DISTANCE_REGRESSION_RELATIVE 🔒
How much a route may grow, relative to its own baseline length, before distance_regressed reports a regression – whichever is larger, this or DISTANCE_REGRESSION_FLOOR_NM.
REFERENCE_ROUTES
A spread of distances and difficulty; each entry tests something specific:
TIME_REGRESSION_FLOOR_MS 🔒
The absolute floor time_regressed applies alongside TIME_REGRESSION_RELATIVE, in milliseconds, so the two fastest cases here (the short Gulf of Trieste hops, under 100 ms each) are not held to a tighter margin in absolute terms than scheduler jitter alone can already account for.
TIME_REGRESSION_RELATIVE 🔒
How much slower a route may run, relative to its own baseline time, before time_regressed reports a regression – whichever is larger, this or TIME_REGRESSION_FLOOR_MS.

Functions§

distance_regressed
Whether current_nm counts as a regression against baseline_nm – see DISTANCE_REGRESSION_RELATIVE and DISTANCE_REGRESSION_FLOOR_NM for the margin. A route that got shorter never regresses here, whatever the reason.
load_baseline
Loads a Baseline from path. A missing file reads as an empty baseline, not an error – the ordinary state before bench has ever been run with --write-baseline, or for a ReferenceRoute just added and not yet measured.
parse_baseline_line 🔒
The one-line, tab-separated format load_baseline reads and write_baseline writes: name\troute_nm\telapsed_ms, one ReferenceRoute per line, blank lines and #-comments ignored.
time_regressed
Whether current_ms counts as a regression against baseline_ms – see TIME_REGRESSION_RELATIVE and TIME_REGRESSION_FLOOR_MS for the margin. A run that got faster never regresses here, whatever the reason.
write_baseline
Writes entries to path as parse_baseline_line’s own format, in REFERENCE_ROUTES’s own order rather than whatever order a Baseline’s own hash map would iterate in – so the file reads the same top-to-bottom as bench’s own printed table, and so a diff between two baselines is a diff between two runs, not shuffled noise.

Type Aliases§

Baseline
Every ReferenceRoute’s own BaselineEntry, keyed by ReferenceRoute::name.