From e1fa3ace8d7fe942a8ed3e5251d9573d3c7638b5 Mon Sep 17 00:00:00 2001 From: xfocus3 Date: Mon, 1 Jun 2026 15:49:59 +0100 Subject: [PATCH 1/3] docs: show how to benchmark across git branches --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 3543214..c780919 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,20 @@ option: hyperfine -L compiler g++,clang++ '{compiler} -O2 main.cpp' ``` +A common use case is comparing the same command across multiple Git branches. Use `--setup` +to switch branches once before each set of timing runs, so the branch switch is not part of +the measured command: +```sh +hyperfine \ + --parameter-list branch main,performance-improvements \ + --setup 'git switch {branch}' \ + 'rails runner true' +``` + +Make sure your working tree is clean before switching branches. If you want to benchmark +uncommitted changes, consider using `git worktree` and benchmarking the same command in each +worktree instead. + ### Intermediate shell By default, commands are executed using `sh` on Unix (resolved through `PATH`) or `cmd.exe` on Windows. From c974f9b4d9b5c76db1710330106ab211bea8767d Mon Sep 17 00:00:00 2001 From: xfocus3 <211965064+xfocus3@users.noreply.github.com> Date: Mon, 1 Jun 2026 20:43:03 +0100 Subject: [PATCH 2/3] docs: mention branch checkout side effect --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c780919..32742b7 100644 --- a/README.md +++ b/README.md @@ -98,9 +98,10 @@ hyperfine \ 'rails runner true' ``` -Make sure your working tree is clean before switching branches. If you want to benchmark -uncommitted changes, consider using `git worktree` and benchmarking the same command in each -worktree instead. +Make sure your working tree is clean before switching branches. Because this `--setup` command +changes the checkout, the repository will remain on the last branch from `--parameter-list` +after the benchmark finishes. If you want to benchmark uncommitted changes, consider using +`git worktree` and benchmarking the same command in each worktree instead. ### Intermediate shell From 094d0121efd002efc692a0c141c119f5914a3f11 Mon Sep 17 00:00:00 2001 From: David Peter Date: Mon, 5 Oct 2026 11:53:24 +0200 Subject: [PATCH 3/3] docs: simplify branch comparison example --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 32742b7..d949189 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,9 @@ the measured command: hyperfine \ --parameter-list branch main,performance-improvements \ --setup 'git switch {branch}' \ - 'rails runner true' + 'python main.py' ``` -Make sure your working tree is clean before switching branches. Because this `--setup` command -changes the checkout, the repository will remain on the last branch from `--parameter-list` -after the benchmark finishes. If you want to benchmark uncommitted changes, consider using -`git worktree` and benchmarking the same command in each worktree instead. - ### Intermediate shell By default, commands are executed using `sh` on Unix (resolved through `PATH`) or `cmd.exe` on Windows.