{
  "slug": "hyperfine-exposes-iteration-number-to-prepare-and-conclude-0dc366a5d031",
  "title": "hyperfine exposes iteration number to --prepare and --conclude",
  "tools": [
    "hyperfine"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-05T14:11:15.000Z",
  "announced_at": "2026-10-05T14:11:15.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When setup or cleanup must vary by benchmark iteration, read `$HYPERFINE_ITERATION` in a `--prepare` or `--conclude` command; the variable is zero-based. [v1.21.0 release notes](https://github.com/sharkdp/hyperfine/releases/tag/v1.21.0) [README](https://github.com/sharkdp/hyperfine/blob/v1.21.0/README.md)",
    "examples": [
      "hyperfine --prepare 'echo prepare-${HYPERFINE_ITERATION}' --conclude 'echo conclude-${HYPERFINE_ITERATION}' '<benchmark-command>'"
    ],
    "gotchas": [
      "Version: v1.21.0",
      "--prepare <CMD...>: Runs CMD before each timing run; can be specified once for all commands or multiple times, once per benchmark command.",
      "--conclude <CMD...>: Runs CMD after each timing run; can be specified once for all commands or multiple times, once per benchmark command.",
      "$HYPERFINE_ITERATION: Zero-based iteration number exposed to the benchmarked command; v1.21.0 release notes state it is also exposed to --prepare and --conclude commands.",
      "Prerequisite: Use hyperfine v1.21.0 or later for the documented release-note behavior."
    ]
  },
  "why_it_matters": "Make benchmark setup or cleanup commands vary their behavior by iteration.",
  "sources": [
    "https://github.com/sharkdp/hyperfine/releases/tag/v1.21.0",
    "https://github.com/sharkdp/hyperfine/blob/v1.21.0/doc/hyperfine.1"
  ],
  "rank": 0.95027,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2b-20261017",
    "verdict_id": "wave2b-20261017:wave2b-20261017-ef6beaaba4888164-1:gate",
    "evidence_hash": "d4af82ee180cf3c093e5b8093dfcb0a30fe5e03780bb7b16c9cc3d0bd2568623"
  },
  "review": {
    "draft_hash": "c92a70ebb45150af34ee04a32e669c3f4d8f9472fd3fa79d2120b2b12b4295f7",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2b-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.95 >= 0.9; 2 needed) and Jev gave 0.62 (>= 0.6 needed)."
  }
}
