Repository navigation
perf-bench: digest-only baseline re-record tool (tooling, unbreaking) - #770
Merged
Merged
Conversation
What changed: `engine performance` was failing on ~10 open PRs. Two prior lanes established the CI gate's TIMING checks never fire on GitHub runners (--require-same-host never matches the pinned linux-x86_64-ryzen7-7800x3d host), so the ONLY thing that can actually fail is a byte-identical output-digest mismatch against crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json. Several open PRs legitimately change rendered output and trip that correctly - they need their affected digests re-recorded, but perf-bench had no way to do that without `--json`/`--update-baseline` overwriting the whole report, including the Ryzen-only `metrics` and `meta.host_fingerprint`, which would silently destroy the timing baseline and disable --require-same-host forever. Adds crates/perf-bench/scripts/merge_digests.py: copies ONLY the named cases' `digests` from a freshly recorded report into the committed baseline via a text splice (not a re-serialize), leaving metrics/meta/schema_version/ targets/unmeasured and every non-named case byte-identical - verified both by construction and by a self-check before it writes. No case list defaults to "update everything"; every case must be named explicitly with --case, and zero --case flags is a legitimate no-op, not a shortcut. Refuses to run if the baseline/new-report case-id sets differ, if a named case is missing from either, or if a case is repeated on the command line. Documents the re-record process in crates/perf-bench/README.md: digests are portable (proven separately: a full macOS/arm64 recording matched the committed Linux baseline byte-for-byte across all 26 cases/214 digest entries), metrics/meta are not and must never be regenerated off the pinned reference host, and a PR author re-recording digests must justify in the PR why the new rendered output is correct - a digest update is a claim of intent, which is the entire reason the gate exists. Applied as a worked example to #699 (qed-glyph) in a separate commit/push to that PR's own branch, not included here. Known unrelated breakage, noted but not fixed here: perf-bench's separate `memprofile` bin fails to link on macOS (`_malloc_trim` is glibc-only); the main `flashtex-perf-bench` binary is unaffected. Worked around throughout by building with `--bin flashtex-perf-bench`. Confirmed by reproduction: `cargo build --release --bin memprofile` -> "Undefined symbols ... _malloc_trim ... ld: symbol(s) not found for architecture arm64". Probably worth its own issue; not filed here to stay in scope. What was run: - python3 -m unittest discover -s crates/perf-bench/scripts -p 'test_*.py': Ran 6 tests in 0.005s, OK (round-trip identity, single-case merge leaves meta/other-case/other-fields untouched, and all three refusal paths: mismatched case-id sets, unknown --case, duplicate --case). - Manual round-trip proof against the real 126 KB committed baseline (self vs self, 0 cases): `diff`/`cmp` both report byte-identical. - Manual one-case proof against a real macOS --release recording of this repo's own corpus (case `lecture-notes`, the #699 worked example): only that case's 10 digest keys changed; independently verified (separate script, not the tool's own report) that schema_version/meta/targets/ unmeasured and every other case/field were untouched. Next step: Commander/reviewers hand out the remaining ~6 PRs with legitimate rendering changes to their respective authors, each re-recording with this tool and justifying their own case(s) in their own PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222
added a commit
that referenced
this pull request
Sep 16, 2026
…699) What changed: This PR (agent/daniel-parent/qed-glyph, #699) intentionally changes how a proof's QED mark renders: amsthm's `\openbox` (four drawn rules) instead of the glyph-less U+220E, which has no glyph in the shipped fonts. That is exactly the rendering path `lecture-notes` exercises, so its 10 output digests (cold.reply, export.pdf, and 8 warm-scenario reply hashes) change; every other case's digests, and all `metrics`/`meta`, are untouched. Re-recorded with the new digest-only merge tool from #770 (see that PR for the full mechanism and rationale): cargo build --release --bin flashtex-perf-bench # CARGO_TARGET_DIR=target-perfdigest, CARGO_BUILD_JOBS=4 ./target/release/flashtex-perf-bench --json /tmp/report.json python3 crates/perf-bench/scripts/merge_digests.py \ --baseline crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json \ --new-report /tmp/report.json --case lecture-notes \ --out crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json Recorded on macOS/arm64 (not the pinned Ryzen/Linux reference host), which is fine for digests specifically: they hash only rendered-output bytes, with no timing/RSS/CPU input, and were independently confirmed portable (a full 26-case, 214-digest recording on this machine matched the committed Linux baseline byte-for-byte except for these exact 10 entries). `metrics`/`meta` (host_fingerprint, cpu, build_target, ...) are untouched — this machine's numbers were never written anywhere near the committed file. What was run: - Full-corpus recording (26 cases, release build): 214 digest entries total, 25 of 26 cases unchanged, only `lecture-notes` differs, in exactly the 10 keys listed above (diffed independently with a separate script, not just the merge tool's own report). - merge_digests.py's built-in self-check (schema_version/meta/targets/ unmeasured/every other case/every other field of this case all byte-identical before it would write) passed. - `--print <new report> --baseline <updated baseline>`: no digest mismatch reported for any case (the only FAIL shown is an unrelated font-path timing warning between two macOS runs' font_dirs, irrelevant to the digest gate and irrelevant on CI, where --require-same-host means the timing checks never fire on GitHub's runner pool anyway). Next step: CI's `engine performance` digest check should now pass on this PR. Timing metrics/meta remain the original Ryzen/Linux baseline, so --require-same-host continues to gate correctly wherever it can actually fire. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This was referenced Sep 16, 2026
Contributor
Author
|
Merged to main in integration batch B ( Verified before the push: Confirmed on Closing manually — GitHub had not yet auto-closed it, since the content landed via an |
d-q222
added a commit
that referenced
this pull request
Sep 16, 2026
…ately changes
19 of 26 cases' digests move (167 keys total: cold.reply, export.pdf, and
the warm-scenario reply hashes) -- every case that contains math using
family-0 characters (digits, \sin/\lim-style operators) without lmodern,
which is where this branch's fix (cmr, not rm-lmr, for family 0 absent
lmodern) actually changes rendered box heights. Several non-math-specific
warm scenarios (warm.type-paragraph) also move for documents that contain
math elsewhere: the fix changes a display's box height, and per the PR's
own description every baseline below that box rises with it, so a later
page's plain-paragraph digest reflects the same document-wide reflow.
Unaffected, as expected: cv, letter, listings-manual, unicode-accents,
tikz-heavy (no math using family-0 characters), lmodern-report (already
uses rm-lmr via \usepackage{lmodern}, unaffected by this fix by design),
inline-math (contains math, but not the specific family-0 glyphs this fix
touches).
Verified with crates/perf-bench/scripts/merge_digests.py (#770): only the
named cases' digests changed; schema_version/meta/targets/unmeasured and
every other case/field byte-identical (self-check plus an independent
post-merge diff). metrics/meta.host_fingerprint untouched -- still the
pinned Ryzen/Linux reference host, since digests are portable but timing
is not. Re-ran --check against the updated baseline: OK, 549 metrics
compared, no regression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tooling/unbreaking, not a new feature: adds
crates/perf-bench/scripts/merge_digests.py,which copies only the named cases'
digestsfrom a freshly recordedflashtex-perf-bench --jsonreport into the committed baseline(
crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json), leavingmetrics,meta(host_fingerprint, cpu, build_target, ...),schema_version,targets,unmeasured, and every non-named case byte-identical. Also updatescrates/perf-bench/README.mdwith the re-record process for a PR author whosechange intentionally alters rendered output.
Why
engine performanceis failing on ~10 open PRs. Two prior lanes established:--require-same-host, which needsmeta.host_fingerprintto match thepinned reference host (
linux-x86_64-ryzen7-7800x3d), which no publicrunner is.
output-digest mismatch against the committed baseline.
Each needs its affected digests re-recorded.
(
cold.reply,export.pdf, per-keystroke warm-scenario reply hashes — seeaggregate()insrc/report.rs), with no timing/RSS/CPU input. Proveddirectly: a fresh
--releaserecording on macOS/arm64 producedbyte-identical
digestsfor all 26 cases (214 digest entries, 0 differing)against the committed Linux/x86_64 baseline.
The gap: perf-bench had no way to update only digests.
--json/--update-baselinewrite a complete fresh report — digests andmetrics and meta. Using that here would silently overwrite the Ryzen
metricsandmeta.host_fingerprintwith macOS values, destroying the realtiming baseline and permanently disabling
--require-same-host. This PR addsa tool that closes that gap without touching anything but the named digests.
Design choices worth flagging
named explicitly with
--case; zero--caseflags is a legitimate no-op(used by the round-trip check), never a shortcut. A blanket update is
exactly how an unintended rendering regression gets laundered into the
baseline — the digest gate's whole purpose is to force a human to look at
each changed case.
JSON the harness writes with alphabetically sorted keys. Rather than
round-tripping through Python's
jsonmodule (risking silentlyreformatting floats/whitespace/key order elsewhere in a 100+ KB line), the
script locates the exact byte span of each named case's
"digests": {...}value and splices it verbatim from the new report into a copy of the
baseline text. Everything outside those spans is never re-emitted — it's
copied straight through.
files, a named case missing from either, or a case repeated on the command
line all abort before anything is written. A self-check re-parses the
merged output and confirms
meta/schema_version/targets/unmeasuredand every other case/field are still byte-identical, as a second line of
defense on top of the splice approach itself.
that new rendered output is correct, not merely different. The README
says plainly: justify per-case, in the PR, why the new output is right —
"CI failed so I re-recorded" is not a justification.
Worked example (separate from this PR)
Applied to #699 (qed-glyph: QED mark is amsthm's
\openbox, not theglyph-less U+220E) as the worked example, in a commit pushed directly to that
PR's own branch (
agent/daniel-parent/qed-glyph), not included here. Resultthere: exactly
lecture-notes's 10 digests changed (the document the perfnotes already flag as missing that glyph),
metrics/metauntouched — seethat PR for the recording and the correctness justification.
Known unrelated breakage (not fixed here)
perf-bench's separate
memprofilebin fails to link on macOS —_malloc_trimis glibc-only:The main
flashtex-perf-benchbinary is unaffected; every build in this PRand in the #699 worked example used
--bin flashtex-perf-bench. Not fixedhere (out of scope) — flagging in case it's worth its own issue.
Overlap check
gh pr list --repo flash-tex/flashtex --state open --search "perf-bench"/"digest"/"engine performance": no other open PR touchescrates/perf-bench/scripts/or proposes a re-record tool.python3 scripts/coord.py claims: only my own other in-flight claims(P0: xctest aborts (signal 6) deterministically at IMECompositionTests.testCancelledCompositionLeavesTheHelperAndLedgerUntouched — regressed today on main, blocks the whole fleet's gate #681-IME-SIGABRT, render-pipeline: fix --no-default-features build (#697) #733-CONFLICT) were held; claimed this work as
GH-PERF-DIGEST-RERECORD.Test results
Round-trip proof against the real committed baseline (126,666 bytes, single
line):
One-case proof, against a real macOS
--releaserecording of this repo's owncorpus (
lecture-notes, the same recording used for #699):Independently verified (separate script, not the tool's own report) against
the pre/post files:
schema_version/meta/targets/unmeasuredequal, theother 25 cases equal in full, and case
lecture-notesequal in every fieldexcept
digests.Not done
touched here — each needs its own author's correctness judgement, per the
task instructions. Handing those out separately.
memprofile's macOS link failure: noted above, not fixed (unrelated,out of scope).
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz