From 7c76a2ccb2c0cc2ff55a6aebfa6b4fca73c624a8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 11 Oct 2026 22:41:08 +0000 Subject: [PATCH] Run each benchmark build from its own checkout BenchmarkDotNet rebuilds the benchmark project it finds from the working directory, so the base build, run from the head checkout, measured the head's code: base and head reported identical allocations. Locally, the base build run from the head checkout reported S57DocumentReader at 7.62 MB on the harbour cell, the head's figure; run from its own tree it reports 27.9 MB, the base's. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YagvELyJKBANk61DyFGUNJ --- .github/workflows/benchmarks.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 8a69f9d..65e4357 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -132,7 +132,10 @@ jobs: run() { # run echo "::group::$2" - dotnet "$1/$DLL" "${ARGS[@]}" --artifacts "$2" + # Run from inside the tree: BenchmarkDotNet rebuilds the benchmark project it + # finds from the working directory, so running the base build from the head + # checkout would measure the head's code. + (cd "$1" && dotnet "$DLL" "${ARGS[@]}" --artifacts "$2") echo "::endgroup::" } @@ -140,12 +143,12 @@ jobs: for ((r = 1; r <= ROUNDS; r++)); do # Alternate the order (base, head, then head, base) so drift cancels out. if [ "$BASE_BUILT" != "true" ]; then - run . "$OUT/head-$r" + run "$GITHUB_WORKSPACE" "$OUT/head-$r" elif ((r % 2)); then run "$RUNNER_TEMP/base" "$OUT/base-$r" - run . "$OUT/head-$r" + run "$GITHUB_WORKSPACE" "$OUT/head-$r" else - run . "$OUT/head-$r" + run "$GITHUB_WORKSPACE" "$OUT/head-$r" run "$RUNNER_TEMP/base" "$OUT/base-$r" fi done