From fd220dff13133cb0fddd61f4ddbc46363ce6fb61 Mon Sep 17 00:00:00 2001 From: Jake Leahy Date: Tue, 29 Oct 2024 19:34:43 +1100 Subject: [PATCH] Don't run on push anymore Test running against itself to see if the numbers will be similar --- .github/workflows/performance.yml | 3 +-- .github/workflows/stats.nim | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 97b7ed1..b646d55 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -1,7 +1,6 @@ name: Benchmarking on: - push: # Remove when finished pull_request: permissions: @@ -34,7 +33,7 @@ jobs: run: cp .github/workflows/bench.sh bench.sh - name: Run on master - run: ./bench.sh master + run: ./bench.sh $GITHUB_SHA - name: Run on branch run: ./bench.sh $GITHUB_SHA diff --git a/.github/workflows/stats.nim b/.github/workflows/stats.nim index 6d2e17a..7ff45b2 100644 --- a/.github/workflows/stats.nim +++ b/.github/workflows/stats.nim @@ -17,8 +17,10 @@ template formatVal(x: float): string = formatFloat(x, ffDecimal, 5) template writeRow(metric: untyped, name: string, lowerBetter = true) = let diff = (when lowerBetter: -1 else: 1) * (candidate.metric - baseline.metric) - percentage = formatFloat((diff / baseline.metric) * 100, ffDecimal, 2) - echo "|", name, "|", formatVal(baseline.metric), "|", formatVal(candidate.metric), "|", percentage, "|" + percentage = (diff / baseline.metric) * 100 + sign = (if percentage >= 0: "+" else: "") + formattedPercentage = sign & formatFloat(percentage, ffDecimal, 2) + echo "|", name, "|", formatVal(baseline.metric), "|", formatVal(candidate.metric), "|", formattedPercentage, "|" echo "| Metric | Baseline | Candidate | Difference (%) |" echo "|--------|----------|-----------|----------------|"