Repository navigation
v0.0.14: Per-benchmark gates, tak detect, tak log, local baselines and commit backfill
tak compare gating can now be configured per benchmark, with report-only benchmarks, an absolute instruction floor and named acceptances. The gate policy is now read from the base revision, and a comparison that compared nothing now fails. New commands and flags cover regressions that already landed on main (tak detect), history over time (tak log), local before/after measurement (tak run --baseline), per-function attribution (tak explain), building and measuring past commits (tak backfill --commits), and two kinds of extra metrics that are reported but never gate. tak is pre-v1: every new flag, key, report wording and file layout below may change. Read Breaking Changes before upgrading CI.
Highlights
- Gating is more precise and harder to get around. Each benchmark can have its own gate, a specific regression can be accepted by name, and a pull request can no longer loosen its own gate by editing
tak.toml. - More ways to read history.
tak detectflags steps that reached main,tak logshows each series over time, andtak backfill --commitsbuilds past commits so there is history to compare against. - More context next to instruction counts. Per-function profiles, custom metrics such as binary size, and DHAT heap-allocation counts are recorded and reported. Only instruction counts gate.
Added
Gating
-
Per-benchmark gates, report-only benchmarks and an instruction floor. A benchmark or subject can set its own
gatetable, which overrides[gate]key by key. A regression now has to exceed bothpctand the newmin_deltafloor. The default floor is 0, so existing verdicts don't change.enabled = falsemakes a benchmark report-only: a rise past its threshold is marked(not gated)and never fails the run. The floor can also be set with--gate-min-delta/TAK_GATE_MIN_DELTA. A benchmark's own gate wins over--gate-pct. When any gate differs from[gate], the report adds agatecolumn and the verdict readsN benchmark(s) above their gate. Otherwise the report is byte-for-byte unchanged. tak now rejects invalid gate values (a negative, NaN or infinitepct, a negative or fractionalmin_delta, unknown keys) when it loadstak.toml. By @jdx in #158.[gate] pct = 1.0 min_delta = 0 [bench.startup] cmd = ["./target/release/mycli", "--version"] gate = { pct = 5.0, min_delta = 20000 } [bench.help] cmd = ["./target/release/mycli", "--help"] gate = { enabled = false } # report only
-
Accept a regression in named benchmarks.
tak compare --accept BENCHwaives the gate for one exact benchmark name. It is repeatable, and every other benchmark still gates. Accepted rows are marked(accepted)and listed with their source. The CI guide shows how to drive the flag from atak-accept:NAMElabel that only maintainers can apply.Tak-Accept: BENCHcommit trailers inBASE..REVare honoured only when[gate] accept_trailers = trueorTAK_ACCEPT_TRAILERS=1is set. When the setting is off, the report lists any trailers it found and says they were ignored. Each trailer names exactly one benchmark using its whole value, commas included, so repeat the trailer to accept several. By @jdx in #153 and #164. -
allow_emptysetting. With[gate] allow_empty = true,TAK_ALLOW_EMPTY=1or--allow-empty, an empty comparison passes with a warning on stderr instead of failing. Under GitHub Actions the warning is a::warning::annotation. Regressions still fail.--allow-emptyis now a global flag, so it also works withtak run --baseline --gate.tak comparereads the setting from the base revision'stak.toml. With jdx/tak-action, also setfail-on-nothing-compared: falseto warn instead of fail. By @jdx in #173.
New commands
-
tak detectchecks for instruction-count regressions that already reached main. Run it aftertak run --recordandtak push. It walks REV's first-parent history (--window, default 20 recorded commits) and compares consecutive recorded points in each series:- It fails only on a step onto REV that exceeds that series' gate, so a main workflow fails once, on the push that introduced the step.
- A step across unrecorded commits is shown as a git range.
- Earlier steps and sustained drift are listed but don't fail.
- It supports per-benchmark gates,
--accept, trailers,--no-gateand--allow-empty. It fails when nothing was compared, including on a first recording. - It needs full history (
fetch-depth: 0).
- name: Detect regressions that landed run: | set -o pipefail tak detect | tee -a "$GITHUB_STEP_SUMMARY"
-
tak logshows each benchmark's history over REV's first-parent commits. It prints one table per bench/tool/runner series, with the instruction-count Δ from the previous measurement and the wall time.-n(default 30) counts recorded commits.--benchfilters, and an unknown name is an error.--html PATHwrites a self-contained HTML report with SVG charts and no scripts or external assets. The CI guide includes a GitHub Pages example.tak historyoutput is unchanged. By @jdx in #160 and #166. -
tak explainandtak run --profile-dirshow which functions an instruction-count change came from.--profile-dir DIRkeeps the cachegrind profile from the run that gave the reported minimum, atDIR/<bench>/<subject>.cachegrind.out.tak explain BASE HEADmatches two such directories and lists the functions whose self cost changed most (--top N, default 10). It only reports and always exits 0. Functions are matched by name, and stripped binaries show up as???. Profiles are not stored in notes, so the base profile has to come from measuring the base yourself. The new attribution guide describes two ways to set that up in CI. By @jdx in #157.tak run --bench startup --profile-dir base -- ./mycli hello # rebuild with the change tak run --bench startup --profile-dir head -- ./mycli hello tak explain base head
Measuring
-
Local baselines.
tak run --save-baseline NAMEsaves a run's records to<git-common-dir>/tak/baselines/NAME.jsonl, which is never committed or pushed and is shared across worktrees.tak run --baseline NAMEmeasures again and prints thetak comparetable, without writing notes. Saving merges by series, so--bench a --save-baseline xupdates onlya. With--gate, the run exits non-zero on a regression past the benchmark's gate. It also fails when it can't check everything it was asked to: nothing ran, a count failed, a series is missing from the baseline or was saved only on another runner class, or a check failed. When everything measured is report-only,--gatepasses and prints a note saying nothing was gated. An older tak refuses to save over a baseline that holds newer-schema records. By @jdx in #155 and #165.tak run --save-baseline before # edit, rebuild tak run --baseline before --gate -
tak backfill --commits RANGEbuilds and measures past commits. Each first-parent commit, newest first, is checked out into a temporary detached worktree. tak runs the new[build]table there, measures the benchmarks from the currenttak.toml, and appends the results to that commit's note, with the commit date asts.- Subjects already recorded for the runner class are skipped.
--forcemeasures again, adding a second record. --limit(default 20) caps builds per run, so rerunning continues where the last run stopped.- Build failures and per-benchmark measurement failures are remembered locally and passed over on later runs.
--force, a[build]change, a runner-class change or (for measurement failures) any edit totak.tomlretries them. A failed instruction count records nothing for that benchmark. --dry-runlists commits and builds nothing.- Programs and directories from the checkout must resolve inside it. tak checks them before and after each
setup,prepare, sample,checkand valgrind run. - On Unix, an interrupt kills only tak's own build and measured process groups, removes the worktrees and exits with the signal's status.
Backfilled numbers are only comparable with CI's if they were built the same way. By @jdx in #159, #171 and #172.
[build] cmd = ["cargo", "build", "--release", "--locked"]
tak backfill --commits main~20..main --dry-run tak backfill --commits main~20..main tak push
- Subjects already recorded for the runner class are skipped.
-
Custom metrics. A
metric.NAMEtable on a benchmark, subject or[defaults]records either a file's size in bytes (file) or the single non-negative number a command prints (cmd). Metrics appear in run output,--export-jsonand notes.tak compareshows them in a separate table and never gates on them. Names must match^[a-z][a-z0-9_]*$.instructions,wall_*andalloc_*are reserved. A metric that can't be taken fails the run, and nothing is recorded. By @jdx in #156.[bench.startup.metric.binary_bytes] file = "target/release/mycli"
-
Heap allocations via valgrind DHAT.
allocations = true(on a benchmark, subject or[defaults]) ortak run --allocationsruns each subject three more times under DHAT. tak records the minimumalloc_blocks,alloc_bytesandalloc_peak_bytes. These appear in run output,--export-jsonand a separatetak comparetable. They are reported only and never gate. Statically linked binaries and programs with their own allocator report 0, and tak warns about it. A DHAT failure produces a warning, and the rest of the measurement is still recorded. When the same benchmark appears on several runner classes,tak comparerows now name the runner. By @jdx in #161.
Fixed
- Background processes no longer hang or spoof instruction counts. valgrind's summary is now read from its own log file instead of the subject's stderr. Before, a process the subject left running could hang counting until it exited, and output that looked like valgrind's summary could be read as the count. cachegrind's
I refs: 0, which it reports when it can't write its output, is now treated as a failed count instead of being recorded as zero. By @jdx in #157 and #161. - Report tables escape
|and backslashes in benchmark, tool and runner names, so a name containing|no longer shifts the columns intak compare,tak run --baselineandtak detect. Control characters in names read from notes are printed as escapes such as\nin every report. By @jdx in #167 and #164.
Changed
- The adoption guide now recommends jdx/tak-action on GitHub Actions. The manual pull-request workflow is fixed: its credential-removal step failed with actions/checkout v6 and later. By @jdx in #163 and #169.
Breaking Changes
-
tak comparefails when nothing was compared. A comparison where no series was measured on both sides now prints the report and then exits non-zero. This happens when the base was never recorded, notes weren't fetched, or the two sides ran on different runner classes. Before, it exited 0. Pass--allow-empty, or set[gate] allow_empty = true, where an empty comparison is expected, such as the first pull request after adopting tak or a runner-class change.--no-gatestill never fails. The report's first line,**Nothing was compared…, is unchanged. Workflows that grep for it should anchor the pattern:grep -q '^\*\*Nothing was compared'. By @jdx in #162. -
tak comparereads its gate policy from the base revision'stak.toml, from git, instead of the working tree. This covers[gate], per-benchmark gates,accept_trailersandallow_empty. A pull request that changes a gate is compared under the base's gate, and the change takes effect once it merges. The report adds a line saying so. Flags and environment variables still override the file.- The base commit and its tree must be in the clone. A missing base or a base
tak.tomlthat doesn't parse is an error, and--no-gatedoesn't waive it. - With no
tak.tomlat the base, built-in defaults apply. - To let a specific regression through on a pull request, use
--acceptinstead of editing the gate. tak detectandtak run --baselinestill read the working tree.
- The base commit and its tree must be in the clone. A missing base or a base
-
Control characters are rejected in names.
tak.tomlbenchmark and subject names,--bench, the runner class andTAK_TOOL(where it becomes the recorded tool name) can no longer contain control characters, newlines included. Rename any that do. By @jdx in #164.
Full Changelog: v0.0.13...v0.0.14