You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/07/05 03:16:25 UTC

(groovy) branch master updated: GROOVY-12127: Improve benchmark framework: Runner calibration/Deterministic dispatch metrics/Cold instance-dispatch bench (loose ends)

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new faee99b839 GROOVY-12127: Improve benchmark framework: Runner calibration/Deterministic dispatch metrics/Cold instance-dispatch bench (loose ends)
faee99b839 is described below

commit faee99b83998b6557bef2bda9968b9eb5dc0b502
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Jul 5 11:42:41 2026 +1000

    GROOVY-12127: Improve benchmark framework: Runner calibration/Deterministic dispatch metrics/Cold instance-dispatch bench (loose ends)
---
 .github/workflows/groovy-jmh-classic.yml                      |  8 +++++++-
 .github/workflows/groovy-jmh.yml                              |  8 +++++++-
 .../src/main/groovy/org.apache.groovy-performance.gradle      | 11 +++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/groovy-jmh-classic.yml b/.github/workflows/groovy-jmh-classic.yml
index 364dc599fd..023ecb6bd1 100644
--- a/.github/workflows/groovy-jmh-classic.yml
+++ b/.github/workflows/groovy-jmh-classic.yml
@@ -74,15 +74,21 @@ jobs:
              subprojects/performance/build/results/jmh/results-${{ matrix.suite }}.json
 
       - name: Fetch historical baseline
+        id: baseline
         run: |
           URL="https://apache.github.io/groovy/dev/bench/jmh/${{ matrix.suite }}/classic/data.js"
           if curl -fsSL "$URL" -o data.js; then
             sed -e 's/^window\.BENCHMARK_DATA = //' -e 's/;[[:space:]]*$//' data.js > prev.json
+            echo 'found=true' >> "$GITHUB_OUTPUT"
           else
-            echo '{}' > prev.json
+            # the action cannot handle an empty external data file, so skip
+            # the compare when no baseline is published (or gh-pages is down)
+            echo 'No baseline for ${{ matrix.suite }} on gh-pages; skipping comparison.'
+            echo 'found=false' >> "$GITHUB_OUTPUT"
           fi
 
       - name: Compare against history
+        if: steps.baseline.outputs.found == 'true'
         uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1
         with:
           tool: 'jmh'
diff --git a/.github/workflows/groovy-jmh.yml b/.github/workflows/groovy-jmh.yml
index 8337f8ac74..caa0310b86 100644
--- a/.github/workflows/groovy-jmh.yml
+++ b/.github/workflows/groovy-jmh.yml
@@ -74,15 +74,21 @@ jobs:
              subprojects/performance/build/results/jmh/results-${{ matrix.suite }}.json
 
       - name: Fetch historical baseline
+        id: baseline
         run: |
           URL="https://apache.github.io/groovy/dev/bench/jmh/${{ matrix.suite }}/indy/data.js"
           if curl -fsSL "$URL" -o data.js; then
             sed -e 's/^window\.BENCHMARK_DATA = //' -e 's/;[[:space:]]*$//' data.js > prev.json
+            echo 'found=true' >> "$GITHUB_OUTPUT"
           else
-            echo '{}' > prev.json
+            # the action cannot handle an empty external data file, so skip
+            # the compare when no baseline is published (or gh-pages is down)
+            echo 'No baseline for ${{ matrix.suite }} on gh-pages; skipping comparison.'
+            echo 'found=false' >> "$GITHUB_OUTPUT"
           fi
 
       - name: Compare against history
+        if: steps.baseline.outputs.found == 'true'
         uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1
         with:
           tool: 'jmh'
diff --git a/build-logic/src/main/groovy/org.apache.groovy-performance.gradle b/build-logic/src/main/groovy/org.apache.groovy-performance.gradle
index 98c8ceaa6a..3bedde5a97 100644
--- a/build-logic/src/main/groovy/org.apache.groovy-performance.gradle
+++ b/build-logic/src/main/groovy/org.apache.groovy-performance.gradle
@@ -76,6 +76,17 @@ tasks.named('jmhClasses') {
     dependsOn tasks.named('clean')
 }
 
+// The clean dependency above forces fresh JMH runs, but without an ordering
+// constraint Gradle may schedule 'clean' BETWEEN other tasks in the same
+// invocation (e.g. deleting freshly-compiled jmh classes before jmhJar
+// packages them, yielding an empty benchmark jar). Ordering-only, so tasks
+// that don't pull 'clean' into the graph are unaffected.
+tasks.configureEach {
+    if (name != 'clean') {
+        mustRunAfter tasks.named('clean')
+    }
+}
+
 var indy = (project.findProperty('indy') ?: 'true').toBoolean()
 
 tasks.named('compileJmhGroovy') {