Skip to main content

Module config

Module config 

Source
Expand description

tak.toml — declared benchmarks.

Named after the tool rather than after its current contents. It already holds more than a command list in spirit, and gates, runner classes and competitor definitions all belong here too; bench.toml would be misnamed the moment the first of those lands.

The point of declaring benchmarks is that CI and a laptop run the same thing. A command line in a workflow file drifts from the one people use locally, and the numbers stop being comparable without anyone noticing.

Structs§

AutoRuns
The limits runs = "auto" works within. Resolved for every subject, so tak run --runs auto can switch a fixed benchmark over without the file having to declare them.
Bench
Build
The build command, resolved and checked.
Config
Subject
A subject with every default applied, ready to measure.
SubjectDecl
One program in a multi-subject benchmark, as written in tak.toml: either a shared [subject.NAME] or a benchmark’s [bench.B.subject.NAME].

Enums§

MetricSource
Where a custom metric’s value comes from, resolved.
Runs
How many timed runs a subject gets.
RunsDecl
runs as written: a count, or a word. Only "auto" is a valid word, checked when the subject is resolved so the error names it.

Constants§

DEFAULT_BUDGET
runs = "auto" defaults: about this much wall time per subject, prepare included, and never fewer or more runs than these. The floor keeps a slow competitor’s result from resting on one or two samples; the ceiling stops a millisecond-scale subject from spending the whole budget on runs that stopped adding information long before.
DEFAULT_MAX_RUNS
DEFAULT_MIN_RUNS
DEFAULT_OK_EXIT_CODES
Exit codes a sample may end with and still count, unless ok_exit_codes says otherwise: success, and nothing else, as a shell would judge it.
DEFAULT_RUNS
Defaults chosen to match tak run’s, so moving a command into tak.toml does not silently change what it measures.
DEFAULT_WARMUP
FILE_NAME
SELF_TOOL
The name a single-command benchmark records under. compare renders this tool as the bare benchmark name.

Functions§

check_platform_exit_codes
Check a subject’s resolved ok_exit_codes against a platform: fail when none of them is possible there, otherwise return the ones that are not, for a warning.
exit_code_range
The range of exit codes a platform can report, when narrower than i32: Unix keeps only the low 8 bits of a process’s status. None where the whole i32 range is possible, as on Windows.
impossible_exit_codes
The codes in codes that a platform can never report, so can never match.
join_codes
Exit codes for a message: 0, 1.
parse_duration
Parse 500ms, 30s, 2m or 1h; a bare number is seconds.