Skip to content

feat: add --omit-failed-runs to exclude failures from statistics (fixes #827)#891

Open
leno23 wants to merge 1 commit into
sharkdp:masterfrom
leno23:feat/omit-failed-runs-827
Open

feat: add --omit-failed-runs to exclude failures from statistics (fixes #827)#891
leno23 wants to merge 1 commit into
sharkdp:masterfrom
leno23:feat/omit-failed-runs-827

Conversation

@leno23

@leno23 leno23 commented May 26, 2026

Copy link
Copy Markdown

Summary

  • Adds --omit-failed-runs to exclude benchmark runs with non-zero exit codes from summary statistics and exported timing data.
  • Requires --ignore-failure so failed runs can complete instead of aborting the benchmark.
  • Reports how many failed runs were omitted in the output and via a warning.

Motivation

Fixes #827. Useful for flaky commands where failed runs should not skew mean/median/stddev, while still recording that failures occurred.

Example

hyperfine --ignore-failure --omit-failed-runs --runs 20 './flaky-test.sh'

If 3 of 20 runs exit non-zero, summary statistics are computed from the remaining 17 runs.

Test plan

  • cargo test
  • Integration test: --omit-failed-runs requires --ignore-failure
  • Integration test: mixed success/failure runs omit failures from statistics

When used together with --ignore-failure, non-zero benchmark runs are
removed from mean/median/stddev and exported timings while reporting
how many runs failed.

Fixes sharkdp#827

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 426887923b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/benchmark/mod.rs
Comment on lines +370 to +373
exit_codes = keep_indices
.iter()
.map(|&index| exit_codes[index])
.collect();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve full exit code history when omitting timings

When --omit-failed-runs is enabled, this block rewrites exit_codes to only successful runs, which drops the non-zero/None statuses from the exported result even though those runs happened. That makes downstream JSON consumers unable to detect failure rate and conflicts with BenchmarkResult's documented meaning of exit_codes as all command invocations; only timing/statistical inputs should be filtered, not the exit-code history.

Useful? React with 👍 / 👎.

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.

FR: Ignore failed run measurements when computing statistics or put failures into a separate bucket

1 participant