Repository navigation
Description
Current behaviour
With benchmarks = true the kit writes two managed workflows, both always and together (src/scaffold.jl, lines 146 to 158): benchmark.yaml and benchmark-history.yaml.
There is no option to write one without the other, or to make the pull request comparison optional.
benchmark.yaml runs on every pull request that touches src, ext, benchmark or the AD fixtures.
It benchmarks the base and the pull request in two separate jobs on two separate ubuntu-latest runners (templates/.github/workflows/benchmark.yaml, lines 48 to 60).
The comment on lines 8 to 13 gives the reason: separate jobs let the AD benchmarks compare across an API change, and keep one runner from loading two heavy AD stacks.
Each benchmark is run once per revision with seconds = 1 (line 110).
compare_comment (src/benchmarks.jl) then reports every ratio against a fixed 5% threshold (CHANGE_THRESHOLD = 0.05, line 365) with red and green markers and a bucket table.
Nothing in the harness controls or measures noise:
- the two revisions never share a runner, so machine differences between the two jobs count as change;
- the runs are not interleaved or repeated;
- no A/A comparison (the same revision twice) is run, so the comment cannot say how large a ratio can be by chance;
- the comment never fails or gates anything, so a reader has to judge each ratio by eye.
benchmark-history.yaml runs on pushes to main and on tags, on one ubuntu-latest job, and deploys plots and tables to a benchmarks branch under history/.
Each deploy replaces that folder (docs/src/getting-started/benchmarking.md, line 89).
The kit's harness (src/benchmarks.jl) records no description of the machine in the results it writes.
Why this is a problem
On shared runners the noise between two jobs is larger than the 5% threshold the comment colours by.
On ComposableRecurrences.jl, on a pull request that changed no timed code, the comment reported ratios from 0.25x to 1.54x.
On another push it reported a uniform 1.35x to 1.8x slowdown in one group, which disappeared on the next run and did not appear in a local alternating A/B of the same two revisions.
Both were on EpiAware/ComposableRecurrences.jl#907, whose benchmark comment is edited in place on each push.
A comment that shows large red and green ratios for unchanged code teaches reviewers to ignore it.
It also costs a long run on every pull request: ComposableRecurrences.jl's suite takes close to the 90 minute job limit (#533 item 3).
Raising or tuning the threshold does not fix this, because the size of the noise is not measured.
Proposed change
Support a second benchmark model next to the current one, and make the pull request comparison optional.
The model below is the one the Wren.jl package (JuliaBayes) uses; this draft describes what is in its bench/ directory.
The Wren.jl model
- A benchmark suite (
bench/suite/run.jl) is run by hand on one named machine.
It writes one JSON file per run, named<UTC timestamp>-<short sha>.json.
The file records the git sha, the commit date, a label, whether the tree was dirty, the Julia version, the CPU model, thread count, memory and OS, the Julia and BLAS thread counts, and the version of every package in the manifest. - Saving is guarded.
The script refuses to save from a dirty tree, since the sha would not describe the code, and refuses to save unless Julia runs with the fixed thread count the runs are compared at.
It sets BLAS to one thread to keep results consistent.
--no-saveprints the table without saving.
--releaselabels the run with the release tag and checks that the commit carries it. - Runs are committed to a
benchmark-resultsbranch (bench/suite/results_branch.jl).
The script adds the file through a temporary worktree, rewritesruns/index.jsonand pushes.
A second script,remove.jl, removes a noisy run by file or sha, after listing it and asking for confirmation. - The suite is not run on CI.
The README says timings there are too inconsistent, and that the runs are made by hand on a maintainer's machine for each commit tomainand each release. - A small website (
bench/web, Svelte and Vite) shows one run as a table, compares two runs (tip against base, cells coloured by ratio, with changes under 5% treated as noise and only faintly coloured up to 10%), and has a history tab with one chart per model.
A workflow (.github/workflows/bench-site.yml) builds it from the results branch and publishes it to abench/folder ongh-pages.
It runs when the results branch is pushed to, whenbench/webchanges, and by hand. - One-off comparisons live in
bench/adhoc/, which has its ownProject.tomland README, so they do not enter the tracked history.
One script there times a reference implementation twice and reports the second as "(repeat)", so the ratio shows drift between two measurements of the same code.
That is a manual A/A check; Wren.jl does not compute a noise band automatically. - Timings use the minimum over samples, which the Wren.jl docs give as the estimator that varies least.
What the kit could add
- Noise band first.
Report an A/A band wherever the kit reports ratios.
Add a mode to the managedbenchmark/run.jlthat runs the suite twice at one revision and saves both, and teachcompare_commentto print, per group, the spread of the A/A ratios (for example the median and the 90th percentile of |log ratio|).
Mark a change only when it lies outside that band, and say in the comment that it is within noise when it does not.
Inbenchmark.yamlthis is one more job (base against base on a second runner), so the comment can show the band measured on the same infrastructure as the comparison. - Optional per-pull-request comparison.
A scaffold option, for examplebenchmark_pr = :always | :label | :off, defaulting to:alwaysso nothing changes on sync.
:labelruns the job only when abenchmarklabel is on the pull request, the waydownstream.yamlis already triggered by a label (templates/.github/workflows/downstream.yaml, lines 14 to 28).
:offomits the workflow.
The comment is advisory under every setting. - Same-runner, interleaved runs as an option.
For packages where the separate-job design is not needed, run base and pull request in one job, alternating revisions for several rounds, and take the minimum of each.
This removes machine-to-machine noise at the cost of the fixture isolation the current comment describes, so it should be opt-in. - A hand-run recording path.
A managedbenchmark/record.jlthat implements the guarded save described above, writing to a results folder on the existingbenchmarksbranch (for exampleruns/, outsidehistory/, which the history deploy owns).
The machine description goes into the file.
It needs the same concurrency group as the history deploy (benchmark-history-deploy, documented inbenchmarking.md) if a workflow ever writes there too. - Compare and history pages in the docs.
Extendbuild_benchmark_page(src/docs_build.jl, line 1544) to readruns/index.json, list runs with machine and label, render a compare table for a chosen pair, and a history table across runs on one machine.
Pages could be Documenter-rendered at build time, avoiding a JavaScript application.
Runs from different machines are shown separately and not compared. - An ad hoc directory.
Scaffoldbenchmark/adhoc/with its ownProject.tomland a README, documented as untracked one-off comparisons, so they have a place that does not feed the history.
Items 1 and 2 solve the problem described above and are independent of the rest.
Evidence
- Kit:
templates/.github/workflows/benchmark.yamllines 8 to 13, 48 to 60 and 110;templates/.github/workflows/benchmark-history.yamllines 1 to 60 and 129 to 137;templates/benchmark/run.jl(single run,seconds = 1);templates/benchmark/compare.jl;src/benchmarks.jllines 365, 530 to 533 and 557 to 575 (run_suite);src/scaffold.jllines 146 to 158;docs/src/getting-started/benchmarking.mdlines 50 to 116.
A search of the kit for interleaving, repeated runs, A/A comparison or same-runner execution finds none. - ComposableRecurrences.jl:
.github/workflows/benchmark.yamlis identical to the template.
Its run budget is 90 minutes per job (line 53). - Wren.jl (public, JuliaBayes):
bench/README.md,bench/suite/run.jl,bench/suite/results_branch.jl,bench/suite/remove.jl,bench/web/src/lib/compare.ts(lines 3 to 8, thresholds),.github/workflows/bench-site.yml,bench/adhoc/README.md,docs/src/howtos/benchmarking.md. - Related open issues: CI gaps seen under a busy merge queue: test timeout, main cancellations, benchmark budget, AD Julia versions, ext coverage, stale pages.jl #533 item 3 (benchmark job budget and an opt-in regression threshold), Managed CI has no thread count, and benchmarks run on Julia 1 only #536 (thread count and Julia versions for benchmarks), benchmark-history runs every revision in one job, which does not scale #534 and benchmark-history: HEAD's test/ADFixtures is staged once and used for every tagged revision #539 (benchmark history scaling).
None of them covers measuring or reporting noise, or a hand-run model.
Generated by Claude Code
Activity
seabbs-bot commentedon Dec 1, 2026
A working version of items 1, 3 and 4 now exists in EpiAware/ComposableRecurrences.jl#926, so here is a concrete replacement for the per-PR job.
What was built there
benchmark/ab.jl: one job on one machine.Each round runs base, candidate and base again, each a fresh process, in an order that rotates by round.
The two base runs give the A/A ratio of every benchmark.
benchmark/verdict.jl: about 150 lines with no dependencies.A benchmark's band is the larger of the 90th percentile of |log A/A ratio| over its group and its own largest A/A ratio.
A benchmark is called faster or slower only when its minimum and its median are both outside their bands and every round agrees in sign.
benchmark/suite/run.jl: the hand-run recording path of item 4, with the machine in the file head,runs/<machine>/on abenchmark-resultsbranch, and a statichistory.html(item 5 without a site build).What it measured
Redesign (f1d5fd6) against the earlier
main(7b6a4ee), 7 cases, 6 targets, 3 rounds, on a 4-core cloud VM with nothing else running:So a single base-against-PR pair can show 1.5x on unchanged code, on one machine, which is what the current comment reports.
The band is conservative: it is the tail of one A/A ratio, and a verdict is taken on the median of the rounds.
With three rounds this run cannot see a change under about 20%.
Proposed replacement for
benchmark.yamlOne job in place of the
prandmainmatrix and thecomparejob:What the kit would need
benchmark/ab.jlthat alternates processes of the managedbenchmark/run.jlover worktrees of the two commits, with the package'sbenchmarkfolder copied onto both so they run the same suite.The ComposableRecurrences script drives its own
matrix.jl; the kit's would driverun_suite.compare_comment(rounds_dir)taking the rounds, with the band and verdict rule above in place ofCHANGE_THRESHOLD.The rule is pure functions on
(name, min, median)rows, so it can move intoBenchmarksas it is.benchmark_pr = :always | :label | :offas in item 2: a round costs two base runs and one candidate run, so a package with a long suite will want:label.The grid measured above does not fit a job.
Primal with the two reverse modes took about 42 minutes a round here, so a 120 minute job holds two rounds of that, or three of a shorter case list.
A shared runner is still noisier than a quiet machine, but the band is measured on that runner in that hour, so the comment says "within noise" where it now says 1.3× to 3.6×.
Generated by Claude Code
seabbs commentedon Dec 3, 2026
No to all this.
yes to this if not already doing it this way?
test: expect the per-group matrix in the default benchmark workflow
test: cover benchmark workflow options, interleaving and history grid
feat: interleaved benchmark comparison by default, version/threads op…
feat: split the interleaved benchmark suite across a per-group matrix
test: expect the per-group matrix in the default benchmark workflow
fix: mark the separate layout, key the history cache on the resolved …
test: cover benchmark workflow options, interleaving and history grid
feat: interleaved benchmark comparison by default, version/threads op…
feat: split the interleaved benchmark suite across a per-group matrix
test: expect the per-group matrix in the default benchmark workflow
fix: mark the separate layout, key the history cache on the resolved …
test: cover benchmark workflow options, interleaving and history grid
feat: interleaved benchmark comparison by default, version/threads op…
feat: split the interleaved benchmark suite across a per-group matrix
test: expect the per-group matrix in the default benchmark workflow
fix: mark the separate layout, key the history cache on the resolved …
test: cover benchmark workflow options, interleaving and history grid
feat: interleaved benchmark comparison by default, version/threads op…
feat: split the interleaved benchmark suite across a per-group matrix
test: expect the per-group matrix in the default benchmark workflow
fix: mark the separate layout, key the history cache on the resolved …
Release v0.5.0 (#587)