Skip to content

perf(miri): trim heavy tests so the miri job finishes in reasonable time#1537

Merged
daniel-noland merged 1 commit into
mainfrom
pr/miri-perf
May 15, 2026
Merged

perf(miri): trim heavy tests so the miri job finishes in reasonable time#1537
daniel-noland merged 1 commit into
mainfrom
pr/miri-perf

Conversation

@daniel-noland
Copy link
Copy Markdown
Collaborator

@daniel-noland daniel-noland commented May 14, 2026

Three independent miri-only adjustments collected for the per-CI-run budget. All are no-ops outside cfg(miri):

  • config/src/utils/collapse.rs: the bolero generator for test_bolero_collapse_prefix_lists shrinks from (prefix_max=100, exclude_max=100, addr_count=1000) to (10, 10, 100) under miri. Miri's borrow-stack cost on prefix-trie traversal is ~100-1000x; the algorithmic coverage is largely the same with the smaller shape.
  • nat/src/stateless/test.rs: test_full_config was dominated by #[traced_test] subscriber dispatch (formatting, TLS atomics, layer walk, capture mutex) on per-packet debug! calls; hundreds of events per run, each disproportionately expensive under miri. Skip the subscriber install under miri, gate out the println! debug dump, and use [packet] rather than vec![packet] to drop one per-call allocation.
  • miri.just: weak_failure_rate 0.15 -> 0.05. The 0.15 value was inflating miri's weak-memory failure injection beyond what the protocol invariants are tuned for; 0.05 still exercises the path and gives shuttle headroom for other interleavings. We should still (sometimes) run with higher weak failure rates, but no need to burn endless resources on it.

@daniel-noland daniel-noland self-assigned this May 14, 2026
@daniel-noland daniel-noland added the clean-up Code base clean-up, no functional change label May 14, 2026
@daniel-noland daniel-noland marked this pull request as ready for review May 14, 2026 23:43
@daniel-noland daniel-noland requested a review from a team as a code owner May 14, 2026 23:43
@daniel-noland daniel-noland requested review from Fredi-raspall and Copilot and removed request for a team May 14, 2026 23:43
@daniel-noland daniel-noland enabled auto-merge May 14, 2026 23:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Three independent miri-only test trims to keep CI miri runtime in budget. The collapse fuzz test shrinks its generator under miri, the stateless NAT full-config test skips the tracing subscriber and noisy debug print, and miri's weak-memory failure injection rate is dropped from 0.15 to 0.05. All changes are no-ops outside cfg(miri).

Changes:

  • Gate down test_bolero_collapse_prefix_lists generator parameters under miri via cfg_select!.
  • In test_full_config, skip traced_test subscriber and println! dump under miri; drop a per-call vec! allocation in check_packet.
  • Lower weak_failure_rate from 0.15 to 0.05 in miri.just.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
config/src/utils/collapse.rs Use cfg_select! to use smaller generator bounds when running under miri.
nat/src/stateless/test.rs Skip traced_test and debug println! under miri; replace vec![packet] with [packet].
miri.just Reduce weak_failure_rate from 0.15 to 0.05.

Three independent miri-only adjustments collected for the per-CI-run
budget. All are no-ops outside `cfg(miri)`:

* `config/src/utils/collapse.rs`: the bolero generator for
  `test_bolero_collapse_prefix_lists` shrinks from
  (prefix_max=100, exclude_max=100, addr_count=1000) to
  (10, 10, 100) under miri. Miri's borrow-stack cost on prefix-trie
  traversal is ~100-1000x; the algorithmic coverage is the same with
  the smaller shape.
* `nat/src/stateless/test.rs`: `test_full_config` was dominated by
  `#[traced_test]` subscriber dispatch (formatting, TLS atomics, layer
  walk, capture mutex) on per-packet `debug!` calls -- hundreds of
  events per run, each disproportionately expensive under miri. Skip
  the subscriber install under miri, gate out the `println!` debug
  dump, and use `[packet]` rather than `vec![packet]` to drop one
  per-call allocation.
* `miri.just`: weak_failure_rate 0.15 -> 0.05. The 0.15 value was
  inflating test time excessively for some tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Copy link
Copy Markdown
Contributor

@Fredi-raspall Fredi-raspall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@daniel-noland daniel-noland added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit ddb2526 May 15, 2026
35 checks passed
@daniel-noland daniel-noland deleted the pr/miri-perf branch May 15, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean-up Code base clean-up, no functional change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants