Skip to content

ci(perf): bench the merge-base and the PR on the same host - #217

Merged
DrunkOnJava merged 1 commit into
mainfrom
ci/perf-same-host-baseline
Oct 26, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
ci/perf-same-host-baseline

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

The Perf gate now benches a PR's merge-base and the PR in the same job on the same host, instead of comparing against a baseline cached from an earlier main run on whatever runner that was.

Spec reference

CI only; no format change. Fixes a false-red gate: a red check is a defect to fix (docs/maintaining.md, housekeeping item 6).

Evidence that the old comparison measured hardware, not code:

  • #215 touched no benchmarked code (a fixture generator, the streaming header's CRC table import, docs). Run 40236530892 flagged lz77_decompress/literal_only/16384 (1.77x, then 1.78x), stage1_build_section/mixed_256k (1.39x, 1.35x), mixed_64k (1.36x, 1.36x) and uniform_16k (1.37x, 1.40x) on both passes. A consistent factor across both passes is a host difference.
  • Four dependabot PRs that only bump GitHub Action versions failed the same gate on October 21 (runs 39630925388, 39630790968, 39630500561, 39630491292).

Change

  • actions/checkout fetches full history; the job adds a detached worktree at git merge-base origin/main HEAD, runs the PR's run-benches.sh there with CARGO_TARGET_DIR pointing at the workspace target (baseline main), then benches the PR merge commit (pr). The gate script, ratio (1.20x), absolute floor (5 µs) and confirmation re-run are unchanged.
  • rm -rf target/criterion first, because rust-cache can restore criterion output measured on another host.
  • The baseline cache restore/save steps are removed; push to main runs the benches as a smoke check.
  • run-benches.sh skips a bench target the tree being benched does not declare, so the PR's script also runs on an older merge-base.
  • timeout-minutes: 45 for two builds and up to three bench passes.

Test plan

  • YAML parses; bash -n on the script
  • Confirmed criterion 0.7 writes to $CARGO_TARGET_DIR/criterion when set (criterion-0.7.0/src/lib.rs, cargo_target_directory), so both baselines share one directory
  • This PR's own Perf run exercises the new path end to end (run 40239101586): baseline merge-base ab1d42b, candidate merge commit f334e17, same host. All 8 cells within thresholds: lz77_decompress/literal_only/16384 0.990x, stage1_build_section/mixed_256k 1.001x, mixed_64k 1.003x, uniform_16k 1.009x, the cells that read 1.35–1.78x against the cached baseline on fix(fixtures): write the R2000 file-header CRC and end sentinel #215.

Source-provenance declaration

Clean-room declaration. CI configuration only, written from scratch. No Autodesk SDK, ODA SDK, LibreDWG or other DWG implementation source was consulted.

The gate compared a PR run against a criterion baseline cached from the
last push to main. Hosted runners differ in CPU, so whenever the two ran
on different hardware every bench moved by a constant factor the
confirmation re-run cannot clear. PR #215 touched no benchmarked code
and still failed with lz77_decompress and stage1_build_section
1.35-1.78x slower on both passes; four dependabot PRs that only bumped
action versions failed the same way on October 21.

A PR run now checks out its merge-base with main in a second worktree,
benches it as baseline `main` into the same target directory, then
benches the merge commit as `pr`, so the ratio and absolute floor judge
code rather than hardware. Stale criterion output restored by
rust-cache is removed first. The baseline cache steps are gone; a push
to main just runs the benches. run-benches.sh skips a target the tree
being benched does not declare, so it also runs on an older merge-base.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T22:13:19.385492Z 5d9d312 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@DrunkOnJava
DrunkOnJava merged commit 943eaeb into main Oct 26, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/perf-same-host-baseline branch October 26, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant