From 918469eb69798c400be9018741e27ee881fb107e Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Thu, 1 Oct 2026 15:03:31 -0700 Subject: [PATCH 1/2] ci: run benchmark comparison on pull requests only, and shorten it The benchmark job checks out github.base_ref as the previous code, but that is only set on pull_request events. On pushes to master both checkouts were the same commit, so the job spent about 20 minutes comparing master with itself (the Sep 30 run compared af07b69 with af07b69). Run it only for pull requests. Benchmarks now run with -benchtime=100ms instead of the default 1s. Echo has 51 benchmarks run 8 times on each side, so the 1s default kept the job at about 20 minutes regardless of the machine. At 100ms one side takes about a minute. Both workflows also get a concurrency group, so a new push to a pull request cancels its superseded runs. Runs on master always finish. Claude-Session: https://claude.ai/code/session_01QKDYQr53zNKkR7nif2CAAq --- .github/workflows/checks.yml | 5 +++++ .github/workflows/echo.yml | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 87342283a..0017bb9e9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -12,6 +12,11 @@ on: permissions: contents: read # to fetch code (actions/checkout) +# Cancel superseded runs of the same pull request; runs on master always finish. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + env: LATEST_GO_VERSION: "1.27" diff --git a/.github/workflows/echo.yml b/.github/workflows/echo.yml index caaff30c0..a13d77465 100644 --- a/.github/workflows/echo.yml +++ b/.github/workflows/echo.yml @@ -12,6 +12,11 @@ on: permissions: contents: read # to fetch code (actions/checkout) +# Cancel superseded runs of the same pull request; runs on master always finish. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + env: LATEST_GO_VERSION: "1.27" @@ -56,6 +61,9 @@ jobs: fail_ci_if_error: false benchmark: + # Compares the pull request against its base branch. github.base_ref is only set for + # pull_request events, so on other events both checkouts would be the same commit. + if: github.event_name == 'pull_request' needs: test name: Benchmark comparison runs-on: ubuntu-latest @@ -79,15 +87,17 @@ jobs: - name: Install Dependencies run: go install golang.org/x/perf/cmd/benchstat@latest + # -benchtime=100ms instead of the default 1s keeps the job to a few minutes; each of + # the 8 runs still measures every benchmark for long enough to compare reliably. - name: Run Benchmark (Previous) run: | cd previous - go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt + go test -run="-" -bench=".*" -benchtime=100ms -count=8 ./... > benchmark.txt - name: Run Benchmark (New) run: | cd new - go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt + go test -run="-" -bench=".*" -benchtime=100ms -count=8 ./... > benchmark.txt - name: Run Benchstat run: | From da4df63acf238bdee7331e88d0e588be2da16b58 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Thu, 1 Oct 2026 15:15:01 -0700 Subject: [PATCH 2/2] ci: describe the benchmark comparison as advisory Claude-Session: https://claude.ai/code/session_01QKDYQr53zNKkR7nif2CAAq --- .github/workflows/echo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/echo.yml b/.github/workflows/echo.yml index a13d77465..59beb28fe 100644 --- a/.github/workflows/echo.yml +++ b/.github/workflows/echo.yml @@ -87,8 +87,8 @@ jobs: - name: Install Dependencies run: go install golang.org/x/perf/cmd/benchstat@latest - # -benchtime=100ms instead of the default 1s keeps the job to a few minutes; each of - # the 8 runs still measures every benchmark for long enough to compare reliably. + # -benchtime=100ms instead of the default 1s keeps the job to a few minutes. The + # comparison is advisory: it reports differences but never fails the build. - name: Run Benchmark (Previous) run: | cd previous