Skip to content

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

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

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

Conversation

@wyf027

@wyf027 wyf027 commented May 16, 2026

Copy link
Copy Markdown

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

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 #781

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

Based on #857 by @alexchenai.

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

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Author

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

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Author

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

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Author

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

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Author

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

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Author

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

@wyf027

wyf027 commented May 17, 2026

Copy link
Copy Markdown
Author

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