Skip to content

perf(bench): exempt audio_mix/buffering_add_one_tick from the 1.10 ratio (#3138) - #3153

Merged
zackees merged 2 commits into
masterfrom
perf/3138-buffering-add-exemption
Oct 31, 2026
Merged

zackees merged 2 commits into
masterfrom
perf/3138-buffering-add-exemption

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

Carries out the maintainer's Decided: on #3138: option 1 — exempt
audio_mix/buffering_add_one_tick from the 1.10 Rust/C ratio by name in the
recorder
, with the absolute cost and the reason recorded, and no
push_ts_front fast path in the FFI layer.

RED — d321093da

ci/test_benchmark_record.py gains the three cases the exemption must satisfy:
the entry names the pair, its measured cost, the machine and the issue; an
exempt pair is not a breach; and the pair stays in the report with its ratio.
The existing over-bound case moves to audio_mix/mix_whole_tick, because the
pair it used is now exempt by decision.

Fails on that commit:

ERROR: test_the_exempt_pair_is_named_with_its_cost_and_issue   (AttributeError: BOUND_EXEMPTIONS)
FAIL:  test_an_exempt_pair_is_not_a_breach
FAIL:  test_an_exempt_pair_stays_in_the_report
Ran 17 tests — FAILED (failures=2, errors=1)

GREEN — 44cdd7f94

  • record.py gains BOUND_EXEMPTIONS, one named entry per pair with the
    measured absolute cost, the machine and the deciding issue (perf: audio_mix/buffering_add_one_tick is 1.19-1.30x the C, above the 1.10x bound #3138).
  • over_bound() skips an exempt pair by name, so --max-ratio no longer
    fails on it; every other pair keeps the gate.
  • summarize() keeps the row and labels it exempt from 110% bound (#3138)
    instead of over …, so the report still carries its ratio and absolute
    numbers; pair_status() is the one place that decides the label.
  • The report records bound_exemptions, and the gate prints each exempt pair
    above the bound with its reason (it is measured, not dropped).
  • docs/rust-port/release-criteria.md documents --max-ratio and the list.

The 5% full-app recording bound of #142 still applies to this pair, and
#3141's --max-ratio gate still covers every other pair — both conditions
from the decision.

Evidence

uv run rust/tools/benchmarks/record.py --cpu 7 --category audio_mix --repeats 3 --max-ratio 1.10
on this host (Ryzen 7 3700X, shared box, loaded), exit 0:

Recorded 12 complete comparisons
exempt (1.13x): audio_mix/buffering_add_one_tick — 46 ns Rust vs 40 ns C
(1.13x on a loaded box 2026-10-31, 1.15-1.21x in #3141's paired runs) on a
Ryzen 7 3700X: one FFI trampoline on a once-per-audio-tick call, no hot spot
left after #3141; exempt decided in #3138, full-app cost still bounded by #142

The other 11 audio_mix pairs are within the bound (0.27x–0.99x) and the run
still exits non-zero if any non-exempt pair goes over (covered by
test_the_gate_still_fails_every_other_breach).

Checks

  • uv run python -m unittest ci/test_benchmark_record.py — 19 tests, OK.
  • ./lint — lane lint: ok (187.6 s).
  • No Rust source, C test or public header is touched; parity is unchanged.

Refs #3138

)

#3138 decided option 1: the pair is one extern "C" shim on a
once-per-audio-tick call at ~46 ns against the C's ~39 ns, with no hot spot
left after #3141, so the Rust/C ratio bound does not apply to it (the 5%
full-app bound of #142 still does).

The three cases the exemption must satisfy: the entry names the pair, its
measured cost, the machine and the issue; an exempt pair is not a breach;
and the pair stays in the report with its ratio.

Fails on this commit: record.BOUND_EXEMPTIONS does not exist and summarize
still marks the pair over the bound.
…tio (#3138)

#3138 decided option 1: name the pair in record.py's BOUND_EXEMPTIONS
with its measured absolute cost, the machine and the issue, instead of
adding a push_ts_front fast path to the FFI layer.

- over_bound() skips an exempt pair by name, so --max-ratio no longer fails
  on it; every other pair keeps the gate.
- summarize() keeps the row and marks it exempt rather than over the bound,
  so the report still carries its ratio and absolute numbers.
- The report records the exemption list, and the gate prints each exempt
  pair above the bound with its reason.
- docs/rust-port/release-criteria.md documents --max-ratio and the list.

Tests: 19 in ci/test_benchmark_record.py pass (three RED cases plus the
gate print/exit paths).
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

  • PR CI green on 44cdd7f94 (run 41197171447): CI Gate ✅, Fast Gate ⚡ 5m45s, Format 🔍, Validate Data, CI Mode.
  • Local: ./lint ok (187.6 s), ci/test_benchmark_record.py 19 tests pass, and the recorder's own gate run (--category audio_mix --repeats 3 --max-ratio 1.10) exits 0 with the pair printed as exempt at 1.13x.
  • No Local-Gate: stamp: the tree is Python + docs only, PR CI already ran the lanes, and the full gate is ~1 h on this host.
  • Already in the merge queue at position 1 (AWAITING_CHECKS); master is two commits ahead and the queue will rebase.
  • Nothing user-visible; no docs/features.md line (bench tooling, not shipped behavior).

Merged via the queue into master with commit d7556f4 Oct 31, 2026
36 checks passed
@zackees
zackees deleted the perf/3138-buffering-add-exemption branch October 31, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant