Skip to content

test: Bound our four slowest parity tests (#2891) - #2898

Merged
vpacher merged 3 commits into
masterfrom
test/2891-bound-slow-parity
Oct 29, 2026
Merged

vpacher merged 3 commits into
masterfrom
test/2891-bound-slow-parity

Conversation

@vpacher

@vpacher vpacher commented Oct 29, 2026

Copy link
Copy Markdown
Member

Bounds the four slow parity tests we wrote (233 s of Fast Gate test time), our part of #2888 row A. Test files only; no library code changes.

Fixes #2891

Results

Test Fast Gate before macOS arm64 before → after Change
obs_core::audio_discard_parity::random_cases_match 147.9 s 58 s → 0.56 s one deque push per channel instead of one per sample (same deque state); 20,000 → 1,000 cases
obs_core::audio_mix_parity::mix_on_every_start_frame → mix_on_sampled_start_frames 31.8 s 17.6 s → 0.62 s the first and last 8 start frames and every 61st (32 of 1,024)
render::state_stacks_parity::sequences 30.9 s 14.3 s → 1.50 s 5,000 → 500 cases
obs_core::audio_mix_parity::mix_matches 21.6 s 12.1 s → 1.88 s 4,096 → 512 cases

Expected in Fast Gate: about 1.5 s, 1.5 s, 3 s and 3.5 s (the CI runner took 1.8x to 2.6x the local time for these tests). Windows 11 (VM, MSVC, debug): 0.77 s, 0.78 s, 1.30 s and 1.96 s.

Commits

  1. test(obs-core): Make audio_discard_parity's random cases cheap and fewer
  2. test(obs-core): Sample the start frames and cut the mix cases of audio_mix_parity
  3. test(obs-graphics): Cut state_stacks_parity's random sequences to 500

How the counts were chosen

The case counts come from the mutants of the source PRs, not a flat cut. Those mutants were not committed, so they were rebuilt from each PR's description and the code, and run with a harness (not committed). For each mutant, two checks:

  1. Every test of the module (Tier 1 and Tier 3) at the new count.
  2. The changed test alone at increasing case counts, 5 runs each, to find how many random cases the mutant needs.
Source Mutants At the new count The changed test alone
#2404 audio discard 19 19 killed 16 fail within 125 cases in every run; 3 need an exact boundary that random inputs do not reach (at 20,000 cases, 2 never failed and 1 failed in 1 of 2 runs); the chosen cases find them
#1909 audio mix (the mix side) 8 + 1 equivalent 8 killed, the equivalent survives (frame 1024 accepted) mix_matches: 7 fail within 64 cases in every run; the 8th (frames counted from 1 ns late) fails mix_on_sampled_start_frames
#2528 state stacks 15 + 1 equivalent 15 killed, the equivalent survives (no max(new_size) in the growth) all 15 fail within 125 cases in every run

The new counts are 8x (1,000 and 512) and 4x (500) the cases the mutants need. state_stacks_parity gets 4x: 1,000 cases would still take about 6 s on the CI runner.

In audio_discard_parity, the cost was not the case count alone. Each side built its 8 input deques with one deque_push_back() per f32 and read them back with one deque_pop_front() per f32: about 100,000 calls per case. Source::new now reserves the capacity that one push per f32 reaches (4 bytes doubled until it fits) and pushes each channel once, so each deque starts in the same state (start 0, end at the size, the same capacity). The new test one_push_matches_one_push_per_sample checks that for 0 to 300 frames and the power-of-two edges up to 3,199. That alone took the test from 58 s to 11 s with all 20,000 cases.

Each changed proptest block has a comment with its count, the count before and the mutant evidence. The proptest regression files keep the seeds the mutants failed on.

Test cost

New and changed tests, macOS arm64, debug, 25 runs each: longest run 1.88 s (mix_matches), peak RSS 13 to 17 MB, no own threads. The new one_push_matches_one_push_per_sample takes less than 0.1 s.

Verification

  • cargo fmt --all --check; clippy -p obs-data -p obs-graphics -p obs-core --all-targets -- -D warnings clean.
  • obs_core::audio_discard 25/25, obs_core::audio_mix 30/30, state_stacks 11/11 on macOS arm64 and on Windows 11 (VM, MSVC toolchain, the C oracles compiled by MSVC).
  • Local gate, stamped (build-rust, Debian 13, the pinned ci-lint local-gate run): lint 75 s, rust-test 169 s, cross 96 s, tier2-linux 312 s; 5 min 40 s. The head carries the Local-Gate and Ci-Attestation trailers for its exact tree.

🤖 Generated with Claude Code

vpacher and others added 3 commits October 29, 2026 09:28
random_cases_match took 147.9 s in Fast Gate (58 s on an M-series Mac),
the slowest test of the step (#2891).

Two changes:

- Each side built its 8 input deques with one deque_push_back() per
  f32 (up to 3,200 frames per channel) and read them back with one
  deque_pop_front() per f32: about 100,000 calls per case. Source::new
  now reserves the capacity that pushing one f32 at a time from empty
  reaches (4 bytes doubled until it fits) and pushes each channel once;
  end() pops each deque once. Each deque starts in the same state as
  before (start 0, end at the size, the same capacity) and the same
  samples come back. The new one_push_matches_one_push_per_sample
  checks that for 0 to 300 frames and the power-of-two edges up to 3,199.
  With 20,000 cases: 58 s to 11 s.
- 20,000 cases to 1,000. The 19 mutants of #2404, rebuilt and run
  again: every one still fails the audio_discard tests. Run against
  random_cases_match alone, 5 runs each, 16 fail within 125 cases in
  every run. The other 3 (no 1 ns adjustment, in sync as `>`, the shim
  clearing timing_set only with the warning) need an exact boundary that
  random inputs do not reach: at 20,000 cases two never failed and one
  failed in 1 of 2 runs. The chosen cases find all three.

random_cases_match: 0.56 s, 17 MB peak RSS over 25 runs (macOS arm64,
debug). The comparison, the input ranges and every other test are
unchanged. The proptest regression file keeps the seeds the mutants
failed on.

Refs #2891

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o_mix_parity

mix_on_every_start_frame took 31.8 s and mix_matches 21.6 s in Fast
Gate (17.6 s and 12.1 s on an M-series Mac), about 3 ms per mix: each
compare_mix() makes two sets of 6 x 8 x 1024 random samples and checks
every sample bit for bit (#2891).

- mix_on_every_start_frame becomes mix_on_sampled_start_frames: the
  first and the last 8 start frames and every 61st between them (32 of
  1024; 61 is prime, so the frames fall on varied offsets), each on the
  frame's time and one ns before and after, at 44.1 and 48 kHz, as
  before.
- mix_matches: 4096 cases to 512.

The mix mutants of #1909, rebuilt (the window end inclusive, = instead
of +=, the start frame ignored, the window start as <=, the start frame
plus one, frames counted from one ns late, the shim ignoring the channel
count or one channel short, and the equivalent frame 1024 accepted):
all 8 real ones still fail the audio_mix tests, and the equivalent one
survives, as before. mix_matches alone, 5 runs each: 7 of 8 fail within
64 cases in every run; frames counted from one ns late fails
mix_on_sampled_start_frames. The window end inclusive needs audio at
the window's end, which the every-frame test did not check either;
mix_matches and Tier 1 find it.

macOS arm64, debug, 25 runs: mix_on_sampled_start_frames 0.62 s and
13 MB peak RSS, mix_matches 1.88 s and 15 MB. The comparison, the
buffering and frame-count tests and the input ranges are unchanged.

Refs #2891

Co-Authored-By: Claude Opus 5.5 <[email protected]>
sequences took 30.9 s in Fast Gate (14.3 s on an M-series Mac): 5,000
random sequences of up to 60 calls, each compared on both sides with the
whole stack state after every call (#2891).

5,000 cases to 500. #2528 lists 16 mutants without naming the 14 it
killed, so they were rebuilt from the core and the shim: push keeping
cur, the pop floor at 1, pop without the erase, the multiply in the
other order, transpose and identity ignored, translate as scale,
state_pop returning the first entry or not popping, the blend reset
with enable not inverted, the op ignoring the function, the function
without dest_a, and in the shim: the erase of the last element keeping
num, push not counting, and the capacity growing by one. All 15 fail
sequences alone within 125 cases in every one of 5 runs; the equivalent
one #2528 names (no max(new_size) in the growth) survives, as before.
1,000 cases would still take about 6 s on the CI runner, so 500 (4x the
need) keeps it under the 5 s that #2888 proposes.

macOS arm64, debug, 25 runs: 1.50 s and 15 MB peak RSS. The calls, the
comparison after every call and every other test are unchanged. The
proptest regression files keep the seeds the mutants failed on.

Refs #2891

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=8cec7172b177aead0ee3374cc102d09e830003a5 secs=340 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793263864,"gate":"rust/all/fmt","host":"linux-x86_64","key":"be9de4060c380e3fd3e326cc0ce090e9ac1874b2ad14138f5f0d3a9c1bc97d08","lane":"lint","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":75,"stamp":"9eaa0726b440abd9db3f8c736ab1f641","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"be9de4060c380e3fd3e326cc0ce090e9ac1874b2ad14138f5f0d3a9c1bc97d08","lane":"lint","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":75,"stamp":"467728ef5aaebb56014fa6076e352270","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"db8feb23281ca0e220c448d68f1be14a5f1062a0216f9e0340321e38e7dfee04","lane":"rust-test","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":169,"stamp":"80eb40a7c4812ab98f972778a57d6bdd","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"7cc8841f5fa7a06f3090aade0155e0457b9c4356c17fa44b5418f11c40df3119","lane":"cross","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":96,"stamp":"dd713ca81ab3614076faf09ec3a0f5f3","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"7cc8841f5fa7a06f3090aade0155e0457b9c4356c17fa44b5418f11c40df3119","lane":"cross","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":96,"stamp":"4c9c4ba7cf6c909e381e9266b8bd25d6","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"7cc8841f5fa7a06f3090aade0155e0457b9c4356c17fa44b5418f11c40df3119","lane":"cross","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":96,"stamp":"558779126ebd09147e4147bd5bea2b6a","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"7cc8841f5fa7a06f3090aade0155e0457b9c4356c17fa44b5418f11c40df3119","lane":"cross","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":96,"stamp":"228629c266e4919d49763da44bdfe222","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
Ci-Attestation: {"at":1793263864,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"53488f90bfeb235b9eecee55e15ed8e9bc3e38e2bc5df515126f9b13b5b82908","lane":"tier2-linux","parents":["c5fdd95feb1daa789bb69e17b52aff8821e3be74"],"secs":312,"stamp":"71a9f175dda786dd227f70632db58ab7","tree":"8cec7172b177aead0ee3374cc102d09e830003a5","v":1,"via":"run"}
@vpacher
vpacher enabled auto-merge October 29, 2026 08:52
@vpacher
vpacher requested a review from zackees as a code owner October 29, 2026 08:52
@vpacher

vpacher commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator

@vpacher
vpacher added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit 6577709 Oct 29, 2026
34 checks passed
@vpacher
vpacher deleted the test/2891-bound-slow-parity branch October 29, 2026 09:11
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.

test: bound our four slowest parity tests (233 s of Fast Gate test time)

1 participant