You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/08/03 22:35:36 UTC

(grails-core) 01/05: perf: add JMH harness and framework-wide grailsIndy toggle for G6

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

jamesfredley pushed a commit to branch perf/indy-vs-callsite-g6
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 885523d12c8c0da2d52191a027bfb69626bb8905
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Mon Aug 3 12:31:43 2026 -0400

    perf: add JMH harness and framework-wide grailsIndy toggle for G6
    
    Import grails-benchmarks from PR 16071 onto the Groovy 6 canary line so
    indy vs classic callsite can be measured locally. Wire -PgrailsIndy through
    CompilePlugin for framework modules (apps already use grails-extension),
    inject groovy-callsite when indy is off (GROOVY-11158), and document the
    local comparison workflow. No PR - experimental branch only.
---
 .../apache/grails/buildsrc/CompilePlugin.groovy    |  20 ++
 gradle/rat-root-config.gradle                      |   1 +
 grails-benchmarks/README.adoc                      | 186 ++++++++++++++
 grails-benchmarks/build.gradle                     | 273 +++++++++++++++++++++
 .../databinding/SimpleDataBinderBenchmark.java     | 141 +++++++++++
 .../benchmarks/gsp/GroovyPageParserBenchmark.java  |  82 +++++++
 .../interceptors/UrlMappingMatcherBenchmark.java   | 144 +++++++++++
 .../grails/benchmarks/ruler/CpuRulerBenchmark.java |  58 +++++
 .../benchmarks/ruler/MemoryRulerBenchmark.java     |  63 +++++
 .../urlmappings/UrlMappingsBenchmark.java          | 109 ++++++++
 .../views/ViewTemplateRenderingBenchmark.java      |  78 ++++++
 .../interceptors/InterceptorFixture.groovy         |  31 +++
 .../urlmappings/UrlMappingsFixture.groovy          |  41 ++++
 .../benchmarks/views/ViewTemplateFixture.groovy    |  52 ++++
 .../grails/benchmarks/report/Benchmark.groovy      |  32 +++
 .../benchmarks/report/BenchmarkComparator.groovy   | 127 ++++++++++
 .../grails/benchmarks/report/CommentPoster.groovy  | 110 +++++++++
 .../grails/benchmarks/report/Comparison.groovy     |  57 +++++
 .../grails/benchmarks/report/JmhCompare.groovy     | 116 +++++++++
 .../grails/benchmarks/report/JmhResults.groovy     | 138 +++++++++++
 .../grails/benchmarks/report/ReportRenderer.groovy | 150 +++++++++++
 .../report/BenchmarkComparatorSpec.groovy          |  54 ++++
 .../benchmarks/report/GoldenReportSpec.groovy      |  71 ++++++
 .../grails/benchmarks/report/JmhCompareSpec.groovy | 123 ++++++++++
 .../grails/benchmarks/report/PostFileSpec.groovy   | 114 +++++++++
 .../src/test/resources/jmh-golden/broad-base.json  |   1 +
 .../src/test/resources/jmh-golden/broad-head.json  |   1 +
 .../src/test/resources/jmh-golden/edges-base.json  |   1 +
 .../src/test/resources/jmh-golden/edges-head.json  |   1 +
 .../test/resources/jmh-golden/expected-broad.md    |  37 +++
 .../test/resources/jmh-golden/expected-edges.md    |  35 +++
 .../test/resources/jmh-golden/expected-headonly.md |  20 ++
 .../test/resources/jmh-golden/expected-norulers.md |  24 ++
 .../test/resources/jmh-golden/expected-numbers.md  |  32 +++
 .../test/resources/jmh-golden/expected-shards.md   |  31 +++
 .../test/resources/jmh-golden/norulers-base.json   |   1 +
 .../test/resources/jmh-golden/norulers-head.json   |   1 +
 .../test/resources/jmh-golden/numbers-base.json    |   1 +
 .../test/resources/jmh-golden/numbers-head.json    |   1 +
 .../resources/jmh-golden/shards-base/shard-a.json  |   1 +
 .../resources/jmh-golden/shards-base/shard-b.json  |   1 +
 .../resources/jmh-golden/shards-head/shard-a.json  |   1 +
 .../resources/jmh-golden/shards-head/shard-b.json  |   1 +
 settings.gradle                                    |   1 +
 44 files changed, 2563 insertions(+)

diff --git a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
index e8375e9f18..7198896aaf 100644
--- a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
+++ b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
@@ -102,6 +102,14 @@ class CompilePlugin implements Plugin<Project> {
             }
         }
 
+        // Framework modules do not apply the Grails Gradle plugin, so grails { indy = ... } never
+        // reaches them. Honour the same -PgrailsIndy toggle used by grails-extension-gradle-config
+        // (and CI matrix.indy) so JMH / full-tree rebuilds can compile the framework and fixtures
+        // with classic callsites or invokedynamic. Property absent => leave Groovy's default alone.
+        final Boolean frameworkIndy = project.hasProperty('grailsIndy')
+                ? Boolean.parseBoolean(project.property('grailsIndy') as String)
+                : null
+
         project.plugins.withId('groovy') {
             project.tasks.withType(GroovyCompile).configureEach {
                 // encoding needs to be the same since it's different across platforms
@@ -133,10 +141,22 @@ class CompilePlugin implements Plugin<Project> {
                 // when both are present.
                 it.groovyOptions.configurationScript =
                         GradleUtils.findRootGrailsCoreDir(project).file('gradle/groovy-compile-configscript.groovy').asFile
+                if (frameworkIndy != null) {
+                    it.groovyOptions.optimizationOptions.indy = frameworkIndy
+                }
             }
             project.tasks.withType(Test).configureEach {
                 it.jvmArgs('-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true')
             }
+            // GROOVY-11158: classic (non-indy) call-site bytecode lives in groovy-callsite.
+            // Inject at configuration time (not afterEvaluate) when -PgrailsIndy=false for
+            // monorepo modules that can resolve the coordinate via grails-bom. Skip included
+            // builds such as grails-gradle/build-logic where :grails-bom is absent.
+            if (Boolean.FALSE.equals(frameworkIndy)
+                    && project.rootProject.findProject(':grails-bom') != null
+                    && project.configurations.findByName('implementation') != null) {
+                project.dependencies.add('implementation', 'org.apache.groovy:groovy-callsite')
+            }
         }
     }
 
diff --git a/gradle/rat-root-config.gradle b/gradle/rat-root-config.gradle
index cfbd56e648..658f69f8e5 100644
--- a/gradle/rat-root-config.gradle
+++ b/gradle/rat-root-config.gradle
@@ -149,6 +149,7 @@ tasks.named('rat') {
             '**/*.log', // exclude log files
             'local-tasks.gradle', // exclude local helper scripts
             '**/spring-configuration-metadata.json', // JSON files cannot contain license headers
+            'grails-benchmarks/src/test/resources/jmh-golden/**', // byte-exact JMH report fixtures; a license header would alter the compared bytes
     ] + rootProject.subprojects.collect{"${rootProject.projectDir.relativePath(it.layout.buildDirectory.get().asFile).toString()}/**/*" }
     // logger.lifecycle("Excludes for RAT task: ${allExcludes.join(', \n')}")
     excludes = allExcludes
diff --git a/grails-benchmarks/README.adoc b/grails-benchmarks/README.adoc
new file mode 100644
index 0000000000..89699a491c
--- /dev/null
+++ b/grails-benchmarks/README.adoc
@@ -0,0 +1,186 @@
+////
+SPDX-License-Identifier: Apache-2.0
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+////
+
+= Grails Benchmarks
+
+JMH microbenchmarks for Grails framework hot paths -- the code that runs on every request or
+every bound object, where a regression directly costs users latency.
+
+This module is a build-time-only harness. It is *not published*, is not part of the BOM, and
+nothing at runtime depends on it.
+
+JMH is licensed under GPLv2 with the Classpath Exception, an ASF Category X license. Its use is
+acceptable here because this build-time-only module is never published or included in Grails runtime
+artifacts.
+
+== Running locally
+
+The repository baseline is JDK 21, so point `JAVA_HOME` at a JDK 21 if it is not your default.
+Run everything from the repository root:
+
+[source,bash]
+----
+JAVA_HOME=/path/to/jdk-21 ./gradlew :grails-benchmarks:jmh
+----
+
+A full run at default settings takes several minutes. While iterating, narrow it to one class
+and cut the iteration counts:
+
+[source,bash]
+----
+JAVA_HOME=/path/to/jdk-21 ./gradlew :grails-benchmarks:jmh \
+  -Pjmh.include=UrlMappingsBenchmark \
+  -Pjmh.forks=1 -Pjmh.warmupIterations=1 -Pjmh.iterations=1
+----
+
+Add allocation profiling with `-Pjmh.profilers=gc`, which populates the `gc.alloc.rate.norm`
+(bytes per operation) metric the CI report shows as an advisory column.
+
+== Comparing results locally
+
+Render a report from a JMH JSON result file with the Gradle comparison task:
+
+[source,bash]
+----
+./gradlew -q :grails-benchmarks:jmhCompare --args="--head build/results/jmh/results.json"
+----
+
+Add `--base <path>` to compare paired base and HEAD results. Add `--output <file>` to write the
+rendered Markdown report to a file as well as standard output.
+
+== Indy vs classic callsite (local)
+
+Grails apps default to Groovy invokedynamic *off* (`grails { indy = false }`). Framework modules
+and this harness honour the same toggle via `-PgrailsIndy` (wired through `CompilePlugin` and
+`gradle/grails-extension-gradle-config.gradle`). Clean between modes so every Groovy class is
+recompiled:
+
+[source,bash]
+----
+# Classic callsite (Grails default / non-indy)
+./gradlew clean :grails-benchmarks:jmh \
+  -PgrailsIndy=false \
+  -Pjmh.resultFile=$PWD/build/jmh-noindy.json \
+  -Pjmh.forks=2 -Pjmh.warmupIterations=3 -Pjmh.iterations=5
+
+# Invokedynamic
+./gradlew clean :grails-benchmarks:jmh \
+  -PgrailsIndy=true \
+  -Pjmh.resultFile=$PWD/build/jmh-indy.json \
+  -Pjmh.forks=2 -Pjmh.warmupIterations=3 -Pjmh.iterations=5
+
+# Compare (treat non-indy as base, indy as head)
+./gradlew -q :grails-benchmarks:jmhCompare \
+  --args="--base build/jmh-noindy.json --head build/jmh-indy.json --output build/jmh-indy-vs-noindy.md"
+----
+
+On Groovy 6, non-indy compilation also needs `groovy-callsite` on the classpath (already managed
+in the canary BOM).
+
+== Gradle properties
+
+|===
+| Property | Default | Purpose
+
+| `jmh.include` | `.*` | Comma-separated benchmark include patterns (regex)
+| `jmh.forks` | `1` | JVM forks per benchmark. CI uses `2`
+| `jmh.warmupIterations` | `1` | Warmup iterations. CI uses `3`
+| `jmh.iterations` | `1` | Measurement iterations. CI uses `5`
+| `jmh.warmupTime` | `1s` | Duration of each warmup iteration
+| `jmh.iterationTime` | `1s` | Duration of each measurement iteration
+| `jmh.resultFormat` | `JSON` | JMH result format
+| `jmh.resultFile` | `build/results/jmh/results.json` | Absolute path for the result file
+| `jmh.profilers` | none | Comma-separated JMH profilers, for example `gc`
+| `jmh.failOnError` | `true` | Fail the build when a benchmark throws
+|===
+
+`jmh.failOnError` defaults to `true` deliberately. JMH otherwise drops a benchmark that throws
+during `@Setup` from the results file while still reporting build success, which would silently
+shrink the comparison set in CI.
+
+== Layout
+
+Benchmarks are Java, under `src/jmh/java`. Setup fixtures are Groovy, under `src/main/groovy`.
+The comparison tool is Groovy in the `report` source set, under `src/report/groovy`.
+
+That split is intentional. A benchmark written in Groovy measures Groovy's dynamic call-site
+machinery as much as the Grails API under test, so the measured method stays in Java. Fixtures
+are Groovy only where the Grails API genuinely requires it -- the URL mappings DSL, the
+`Validateable` trait, and view templates are all closure-based. Fixtures live in `main` rather
+than `src/jmh/groovy` because the `me.champeau.jmh` plugin puts the main source set's output on
+the jmh compile classpath, which keeps the benchmark source set pure Java and preserves normal
+JMH annotation processing.
+
+The `report` source set depends on Groovy alone and on no Grails project. The CI reporting job
+runs it after a bare checkout, so it must render Markdown without compiling the framework.
+
+Benchmarks are grouped by package, and the CI report aggregates per group:
+
+|===
+| Package | Covers
+
+| `urlmappings` | Request URI matching (warm and cold cache) and reverse URL creation
+| `databinding` | Binding a map onto an object, with and without type conversion
+| `gsp` | GSP parsing (template text to generated Groovy source)
+| `interceptors` | Interceptor URI match decisions
+| `views` | JSON and markup view rendering
+| `ruler` | Pure-JDK probes used to detect an unstable CI runner
+|===
+
+The `ruler` benchmarks touch no Grails or Groovy code. Because CI measures the base and head
+revisions on the *same* runner, a ruler that moves between the two halves of a run means the
+runner itself was unstable and the whole comparison is untrustworthy. They are excluded from
+verdicts and group summaries.
+
+== Known gap: validation
+
+`Validateable.validate()` is a genuine hot path and belongs in this suite, but it is not here yet.
+A benchmark was written and then withdrawn because it was too unstable to be useful: measured at
+2 forks x 5 iterations it showed 80-160% relative error, against 15-20% for the pure-JDK rulers on
+the same otherwise-idle machine. At that spread the confidence intervals can never separate, so the
+comparison would report `no clear change` no matter what happened to validation performance, while
+still consuming CI time and contributing a meaningless number to a group geometric mean.
+
+Two things were ruled out. Object construction was moved into `@Setup`, so the map constructor is
+not being measured. Errors were reset between invocations, because `doValidate()` copies an
+object's existing errors into the new error set and repeated validation of a failing object
+otherwise grows that set without bound. Neither brought the variance down to a usable level, which
+points at bimodal behaviour across forks rather than at the fixture.
+
+Anyone picking this up should start by raising the fork count to see whether the distribution is
+bimodal, and by checking whether `findConstraintsEvaluator()` and `evaluator.evaluate()` are
+re-doing work on every call.
+
+== Adding a benchmark
+
+Prefer paths that are hot per request, cheap to construct without a Spring context or servlet
+container, and meaningful to users. Anything with an internal cache is a good candidate, since
+cache-effectiveness regressions are exactly what this suite is meant to catch.
+
+Keep the total benchmark count modest. CI runs the whole suite twice per shard, so every added
+benchmark costs roughly double its runtime on every performance-labelled pull request.
+
+Every `@Benchmark` method must return its result or consume it through a `Blackhole`, otherwise
+the JIT can eliminate the work being measured.
+
+== CI
+
+Upstream PR https://github.com/apache/grails-core/pull/16071 adds `.github/workflows/benchmark.yml`
+to run this suite on pull requests labelled `performance` (merge commit vs base, single runner,
+`:grails-benchmarks:jmhCompare` report). That workflow is intentionally *not* on this experimental
+indy-comparison branch; run the suite locally (see Indy vs classic callsite above). The Groovy
+compare tool lives in `grails-benchmarks/src/report/groovy` and is covered by
+`./gradlew :grails-benchmarks:test`.
diff --git a/grails-benchmarks/build.gradle b/grails-benchmarks/build.gradle
new file mode 100644
index 0000000000..d6d73fb281
--- /dev/null
+++ b/grails-benchmarks/build.gradle
@@ -0,0 +1,273 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+import org.gradle.api.file.DuplicatesStrategy
+import org.gradle.api.tasks.PathSensitivity
+
+import java.util.Properties
+import java.util.zip.ZipFile
+
+plugins {
+    id 'groovy'
+    id 'java-library'
+    id 'me.champeau.jmh' version '0.7.3'
+    id 'org.apache.grails.buildsrc.properties'
+    id 'org.apache.grails.buildsrc.compile'
+}
+
+version = projectVersion
+group = 'org.apache.grails'
+
+// This build-time-only benchmark harness is never published, so it deliberately omits
+// org.apache.grails.buildsrc.publish, org.apache.grails.buildsrc.sbom,
+// org.apache.grails.buildsrc.vulnerability-scan, org.apache.grails.gradle.grails-jacoco,
+// org.apache.grails.buildsrc.dependency-validator, and org.apache.grails.gradle.grails-code-style.
+// The latter remains omitted until existing JMH source import-order and fixture-formatting
+// violations can be remediated together.
+
+sourceSets {
+    report {
+        groovy.srcDirs = ['src/report/groovy']
+    }
+}
+
+// The Groovy fixtures under src/main/groovy build the framework objects whose APIs are
+// closure-based (the URL mappings DSL, the Validateable trait, view templates). The JMH
+// benchmarks themselves live in src/jmh/java and only *call* those fixtures, so that the
+// measured code path is plain Java and does not include Groovy's dynamic dispatch.
+// me.champeau.jmh puts the main source set's output on the jmh compile classpath, which is
+// why the fixtures are in main rather than src/jmh/groovy: keeping the benchmarks in a pure
+// Java source set preserves normal JMH annotation processing.
+dependencies {
+    implementation platform(project(':grails-bom'))
+
+    implementation project(':grails-web-url-mappings')
+    implementation project(':grails-databinding-core')
+    implementation project(':grails-gsp-core')
+    implementation project(':grails-interceptors')
+    implementation project(':grails-views-gson')
+    implementation project(':grails-views-markup')
+    implementation project(':grails-core')
+    implementation 'org.apache.groovy:groovy'
+
+    // The framework modules declare these as compileOnly, so they are absent from the runtime
+    // classpath a benchmark actually executes on. The modules' own test suites add them back
+    // the same way. Without them, URL mapping, interceptor and view benchmarks fail at @Setup
+    // with NoClassDefFoundError: jakarta/servlet/ServletContext.
+    implementation 'jakarta.servlet:jakarta.servlet-api'
+    implementation 'org.springframework:spring-test'
+
+    reportImplementation platform(project(':grails-bom'))
+    reportImplementation 'org.apache.groovy:groovy'
+    reportImplementation 'org.apache.groovy:groovy-json'
+    // GROOVY-11158: report source set is compiled with -PgrailsIndy=false in the indy comparison
+    reportImplementation 'org.apache.groovy:groovy-callsite'
+
+    // Fixtures under main are Groovy; non-indy JMH rebuilds need groovy-callsite on main too
+    implementation 'org.apache.groovy:groovy-callsite'
+
+    // Pull the report source set's full runtime classpath (groovy-json etc.), not only its
+    // compiled classes - the Spock suite exercises JsonSlurper and HttpClient paths.
+    testImplementation sourceSets.report.runtimeClasspath
+    testImplementation 'org.apache.groovy:groovy-test-junit5'
+    testImplementation 'org.junit.jupiter:junit-jupiter-api'
+    testImplementation 'org.junit.platform:junit-platform-suite'
+    testImplementation 'org.spockframework:spock-core'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
+}
+
+apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+
+tasks.register('jmhCompare', JavaExec) {
+    group = 'verification'
+    description = 'Compares JMH JSON results and renders a pull request report.'
+    classpath = sourceSets.report.runtimeClasspath
+    mainClass = 'org.apache.grails.benchmarks.report.JmhCompare'
+}
+
+// The jmh source set compiles and runs against everything main depends on.
+configurations.jmh.extendsFrom(configurations.implementation)
+
+// Every JMH knob the CI workflow needs to override is exposed as a Gradle property so that
+// .github/workflows/benchmark.yml can run a fast PR profile and a slower scheduled profile
+// from the same build. Defaults here are the quick local-development profile.
+jmh {
+    jmhVersion = '1.37'
+    includes = providers.gradleProperty('jmh.include')
+            .map { it.split(',') as List<String> }
+            .orElse(['.*'])
+            .get()
+    fork = providers.gradleProperty('jmh.forks').map { it as Integer }.orElse(1).get()
+    warmupIterations = providers.gradleProperty('jmh.warmupIterations').map { it as Integer }.orElse(1).get()
+    iterations = providers.gradleProperty('jmh.iterations').map { it as Integer }.orElse(1).get()
+    warmup = providers.gradleProperty('jmh.warmupTime').orElse('1s').get()
+    timeOnIteration = providers.gradleProperty('jmh.iterationTime').orElse('1s').get()
+    resultFormat = providers.gradleProperty('jmh.resultFormat').orElse('JSON').get()
+    // A benchmark that throws during @Setup is otherwise dropped from the results file while
+    // the build still reports success, which would silently shrink the comparison set.
+    failOnError = providers.gradleProperty('jmh.failOnError').map { it.toBoolean() }.orElse(true).get()
+    resultsFile = file(providers.gradleProperty('jmh.resultFile')
+            .orElse(layout.buildDirectory.file('results/jmh/results.json').get().asFile.absolutePath)
+            .get())
+    // Comma-separated JMH profilers, e.g. -Pjmh.profilers=gc for allocation reporting.
+    profilers = providers.gradleProperty('jmh.profilers')
+            .map { it.split(',') as List<String> }
+            .orElse([])
+            .get()
+}
+
+def mergeJmhClasspathMetadata = tasks.register('mergeJmhClasspathMetadata') {
+        def mergedMetadataDirectory = layout.buildDirectory.dir('generated/jmh-classpath-metadata')
+        def lineMetadataPrefixes = ['META-INF/services/', 'META-INF/groovy/']
+        def extensionModuleSuffix = 'org.codehaus.groovy.runtime.ExtensionModule'
+        def propertiesMetadataPaths = [
+                'META-INF/spring.factories',
+                'META-INF/spring.handlers',
+                'META-INF/spring.schemas'
+        ]
+
+        inputs.files(configurations.jmhRuntimeClasspath)
+                .withPropertyName('jmhRuntimeClasspath')
+                .withPathSensitivity(PathSensitivity.RELATIVE)
+        outputs.dir(mergedMetadataDirectory)
+        outputs.cacheIf { true }
+
+        doLast {
+            File outputDirectory = mergedMetadataDirectory.get().asFile
+            project.delete(outputDirectory)
+
+            Map<String, Set<String>> lineEntries = new TreeMap<>()
+            Map<String, Map<String, Set<String>>> extensionModuleEntries = new TreeMap<>()
+            Map<String, Map<String, Set<String>>> propertyEntries = new TreeMap<>()
+
+            configurations.jmhRuntimeClasspath.files
+                    .findAll { File artifact -> artifact.name.endsWith('.jar') }
+                    .sort { File artifact -> artifact.absolutePath }
+                    .each { File artifact ->
+                        new ZipFile(artifact).withCloseable { ZipFile zipFile ->
+                            zipFile.entries().each { entry ->
+                                if (entry.directory) {
+                                    return
+                                }
+
+                                String path = entry.name
+                                if (path.endsWith(extensionModuleSuffix)) {
+                                    Properties properties = new Properties()
+                                    zipFile.getInputStream(entry).withCloseable { input ->
+                                        properties.load(input)
+                                    }
+                                    Map<String, Set<String>> entries = extensionModuleEntries.computeIfAbsent(path) {
+                                        new TreeMap<>()
+                                    }
+                                    ['extensionClasses', 'staticExtensionClasses'].each { String key ->
+                                        Set<String> values = entries.computeIfAbsent(key) { new TreeSet<>() }
+                                        properties.getProperty(key, '').split(',').each { String value ->
+                                            if (value) {
+                                                values.add(value.trim())
+                                            }
+                                        }
+                                    }
+                                } else if (lineMetadataPrefixes.any { String prefix -> path.startsWith(prefix) }) {
+                                    Set<String> lines = lineEntries.computeIfAbsent(path) { new TreeSet<>() }
+                                    zipFile.getInputStream(entry).withCloseable { input ->
+                                        input.getText('UTF-8').readLines().each { String line ->
+                                            if (line) {
+                                                lines.add(line)
+                                            }
+                                        }
+                                    }
+                                } else if (propertiesMetadataPaths.contains(path)) {
+                                    Properties properties = new Properties()
+                                    zipFile.getInputStream(entry).withCloseable { input ->
+                                        properties.load(input)
+                                    }
+                                    Map<String, Set<String>> entries = propertyEntries.computeIfAbsent(path) {
+                                        new TreeMap<>()
+                                    }
+                                    properties.stringPropertyNames().each { String key ->
+                                        Set<String> values = entries.computeIfAbsent(key) { new TreeSet<>() }
+                                        properties.getProperty(key).split(',').each { String value ->
+                                            if (value) {
+                                                values.add(value.trim())
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+            lineEntries.each { String path, Set<String> lines ->
+                File outputFile = new File(outputDirectory, path)
+                outputFile.parentFile.mkdirs()
+                outputFile.setText("${lines.join('\n')}\n", 'UTF-8')
+            }
+            extensionModuleEntries.each { String path, Map<String, Set<String>> entries ->
+                File outputFile = new File(outputDirectory, path)
+                outputFile.parentFile.mkdirs()
+                String moduleName = path.startsWith('META-INF/groovy/')
+                        ? 'grails-benchmark-groovy-extension-modules'
+                        : 'grails-benchmark-service-extension-modules'
+                outputFile.withWriter('UTF-8') { writer ->
+                    writer.write("moduleName=${moduleName}\n")
+                    writer.write('moduleVersion=1.0\n')
+                    entries.each { String key, Set<String> values ->
+                        writer.write("${key}=${values.join(',')}\n")
+                    }
+                }
+            }
+            propertyEntries.each { String path, Map<String, Set<String>> entries ->
+                File outputFile = new File(outputDirectory, path)
+                outputFile.parentFile.mkdirs()
+                outputFile.withWriter('UTF-8') { writer ->
+                    entries.each { String key, Set<String> values ->
+                        String escapedKey = key.replace('\\', '\\\\').replace('=', '\\=').replace(':', '\\:')
+                        writer.write("${escapedKey}=${values.join(',')}\n")
+                    }
+                }
+            }
+        }
+}
+
+tasks.named('jmhJar') {
+    dependsOn mergeJmhClasspathMetadata
+    def mergedMetadataDirectory = layout.buildDirectory.dir('generated/jmh-classpath-metadata')
+    def mergedMetadataPath = mergedMetadataDirectory.get().asFile.absolutePath + File.separator
+    def lineMetadataPrefixes = ['META-INF/services/', 'META-INF/groovy/']
+    def propertiesMetadataPaths = [
+            'META-INF/spring.factories',
+            'META-INF/spring.handlers',
+            'META-INF/spring.schemas'
+    ]
+
+    from(mergedMetadataDirectory)
+    eachFile { details ->
+        boolean mergeable = lineMetadataPrefixes.any { String prefix -> details.path.startsWith(prefix) } ||
+                propertiesMetadataPaths.contains(details.path)
+        if (mergeable && !details.file.absolutePath.startsWith(mergedMetadataPath)) {
+            details.exclude()
+        }
+    }
+    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+}
+
+tasks.named('check') {
+    // Benchmarks are not otherwise compiled by the standard lifecycle tasks.
+    dependsOn tasks.named('jmhClasses')
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/databinding/SimpleDataBinderBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/databinding/SimpleDataBinderBenchmark.java
new file mode 100644
index 0000000000..dbebc9198a
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/databinding/SimpleDataBinderBenchmark.java
@@ -0,0 +1,141 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.databinding;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import grails.databinding.SimpleDataBinder;
+import grails.databinding.SimpleMapDataBindingSource;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Measures form and request-map binding into a command-style object. Binding overhead affects
+ * controller actions and command objects on every submitted request.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class SimpleDataBinderBenchmark {
+
+    private SimpleDataBinder binder;
+    private SimpleMapDataBindingSource flatSource;
+    private SimpleMapDataBindingSource conversionSource;
+
+    @Setup
+    public void setup() {
+        binder = new SimpleDataBinder();
+        flatSource = new SimpleMapDataBindingSource(Map.of(
+                "name", "Ada",
+                "age", 42,
+                "accountId", 9_001L,
+                "status", Status.ACTIVE,
+                "createdAt", new Date(1_700_000_000_000L)
+        ));
+        conversionSource = new SimpleMapDataBindingSource(Map.of(
+                "name", "Ada",
+                "age", "42",
+                "accountId", "9001",
+                "status", "ACTIVE",
+                "createdAt", new Date(1_700_000_000_000L)
+        ));
+    }
+
+    @Benchmark
+    public BindingTarget bindFlatMap() {
+        BindingTarget target = new BindingTarget();
+        binder.bind(target, flatSource);
+        return target;
+    }
+
+    @Benchmark
+    public BindingTarget bindMapWithTypeConversion() {
+        BindingTarget target = new BindingTarget();
+        binder.bind(target, conversionSource);
+        return target;
+    }
+
+    public enum Status {
+        ACTIVE,
+        INACTIVE
+    }
+
+    public static final class BindingTarget {
+        private String name;
+        private Integer age;
+        private Long accountId;
+        private Status status;
+        private Date createdAt;
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public Integer getAge() {
+            return age;
+        }
+
+        public void setAge(Integer age) {
+            this.age = age;
+        }
+
+        public Long getAccountId() {
+            return accountId;
+        }
+
+        public void setAccountId(Long accountId) {
+            this.accountId = accountId;
+        }
+
+        public Status getStatus() {
+            return status;
+        }
+
+        public void setStatus(Status status) {
+            this.status = status;
+        }
+
+        public Date getCreatedAt() {
+            return createdAt;
+        }
+
+        public void setCreatedAt(Date createdAt) {
+            this.createdAt = createdAt;
+        }
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/gsp/GroovyPageParserBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/gsp/GroovyPageParserBenchmark.java
new file mode 100644
index 0000000000..b42dbd21d9
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/gsp/GroovyPageParserBenchmark.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.gsp;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.TimeUnit;
+
+import org.grails.gsp.compiler.GroovyPageParser;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Measures GSP source parsing into generated Groovy source, the work performed when GSP templates
+ * are prepared. Parser regressions slow application startup and template reloads.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class GroovyPageParserBenchmark {
+
+    private static final String SMALL_TEMPLATE = "<div>Hello ${name}</div>";
+    private static final String TAGGED_TEMPLATE = """
+            <%@ page expressionCodec=\"HTML\" %>
+            <section class=\"${cssClass}\">
+                <g:link controller=\"book\" action=\"show\" id=\"${bookId}\">${title}</g:link>
+                <g:each in=\"${books}\" var=\"book\"><p>${book.name}</p></g:each>
+            </section>
+            """;
+
+    @Benchmark
+    public byte[] parseSmallTemplate() throws IOException {
+        return parse("small.gsp", SMALL_TEMPLATE);
+    }
+
+    @Benchmark
+    public byte[] parseTemplateWithTagsAndExpressions() throws IOException {
+        return parse("tagged.gsp", TAGGED_TEMPLATE);
+    }
+
+    private byte[] parse(String uri, String template) throws IOException {
+        GroovyPageParser parser = new GroovyPageParser(
+                uri,
+                uri,
+                uri,
+                new ByteArrayInputStream(template.getBytes(StandardCharsets.UTF_8)),
+                StandardCharsets.UTF_8.name(),
+                "HTML",
+                null
+        );
+        return parser.parse().readAllBytes();
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/interceptors/UrlMappingMatcherBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/interceptors/UrlMappingMatcherBenchmark.java
new file mode 100644
index 0000000000..f33fea1547
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/interceptors/UrlMappingMatcherBenchmark.java
@@ -0,0 +1,144 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.interceptors;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import grails.web.mapping.UrlMappingData;
+import grails.web.mapping.UrlMappingInfo;
+import org.grails.plugins.web.interceptors.UrlMappingMatcher;
+import org.grails.web.servlet.mvc.GrailsWebRequest;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Measures URI matcher decisions that select Grails interceptors during request dispatch. Both
+ * matching and rejected paths matter because every interceptor evaluates incoming requests.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class UrlMappingMatcherBenchmark {
+
+    private UrlMappingMatcher matcher;
+    private UrlMappingInfo mappingInfo;
+
+    @Setup
+    public void setup() {
+        matcher = new UrlMappingMatcher(InterceptorFixture.createInterceptor());
+        matcher.matches(Map.of("uri", "/orders/**"));
+        mappingInfo = new BenchmarkUrlMappingInfo();
+    }
+
+    @Benchmark
+    public boolean matchUriPattern() {
+        return matcher.doesMatch("/orders/42", mappingInfo);
+    }
+
+    @Benchmark
+    public boolean rejectNonMatchingUriPattern() {
+        return matcher.doesMatch("/catalog/42", mappingInfo);
+    }
+
+    private static final class BenchmarkUrlMappingInfo implements UrlMappingInfo {
+        @Override
+        public String getURI() {
+            return null;
+        }
+
+        @Override
+        public String getHttpMethod() {
+            return "GET";
+        }
+
+        @Override
+        public String getVersion() {
+            return null;
+        }
+
+        @Override
+        public String getControllerName() {
+            return "orders";
+        }
+
+        @Override
+        public String getActionName() {
+            return "show";
+        }
+
+        @Override
+        public String getNamespace() {
+            return null;
+        }
+
+        @Override
+        public String getPluginName() {
+            return null;
+        }
+
+        @Override
+        public String getViewName() {
+            return null;
+        }
+
+        @Override
+        public String getId() {
+            return "42";
+        }
+
+        @Override
+        public Map<?, ?> getParameters() {
+            return Collections.emptyMap();
+        }
+
+        @Override
+        public void configure(GrailsWebRequest webRequest) {
+        }
+
+        @Override
+        public boolean isParsingRequest() {
+            return false;
+        }
+
+        @Override
+        public Object getRedirectInfo() {
+            return null;
+        }
+
+        @Override
+        public UrlMappingData getUrlData() {
+            return null;
+        }
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/CpuRulerBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/CpuRulerBenchmark.java
new file mode 100644
index 0000000000..497c82bc87
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/CpuRulerBenchmark.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.ruler;
+
+import java.util.concurrent.TimeUnit;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Runner-health probe: base and head run on the same runner, so if this ruler moves between the
+ * two halves, the runner was unstable and the benchmark comparison is untrustworthy.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class CpuRulerBenchmark {
+
+    private int state = 0x13579bdf;
+
+    @Benchmark
+    public long integerArithmetic() {
+        long result = state;
+        for (int index = 1; index <= 1_024; index++) {
+            result = (result * 1_103_515_245L + index) ^ (result >>> 13);
+        }
+        state = (int) result;
+        return result;
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/MemoryRulerBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/MemoryRulerBenchmark.java
new file mode 100644
index 0000000000..c5b572d8d4
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/ruler/MemoryRulerBenchmark.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.ruler;
+
+import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Runner-health probe: base and head run on the same runner, so if this ruler moves between the
+ * two halves, the runner was unstable and the benchmark comparison is untrustworthy.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class MemoryRulerBenchmark {
+
+    private byte[] source;
+
+    @Setup
+    public void setup() {
+        source = new byte[8_192];
+        for (int index = 0; index < source.length; index++) {
+            source[index] = (byte) index;
+        }
+    }
+
+    @Benchmark
+    public byte[] allocateAndCopyArray() {
+        return Arrays.copyOf(source, source.length);
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/urlmappings/UrlMappingsBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/urlmappings/UrlMappingsBenchmark.java
new file mode 100644
index 0000000000..8e17aaf8ec
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/urlmappings/UrlMappingsBenchmark.java
@@ -0,0 +1,109 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.urlmappings;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import grails.web.mapping.UrlCreator;
+import grails.web.mapping.UrlMappingInfo;
+import org.grails.web.mapping.DefaultUrlMappingsHolder;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Measures request URI matching and reverse URL creation, which are performed for every routed
+ * Grails request and generated link. Cache regressions here directly increase request latency.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class UrlMappingsBenchmark {
+
+    private static final String WARM_URI = "/catalog/books/42";
+    private static final String EXPECTED_REVERSE_URL = "/catalog/books/42";
+    private static final int COLD_URI_COUNT = 16_384;
+
+    private DefaultUrlMappingsHolder holder;
+    private String[] coldUris;
+    private Map<String, Object> reverseParameters;
+    private int coldUriIndex;
+
+    @Setup
+    public void setup() {
+        holder = UrlMappingsFixture.createHolder();
+        coldUris = new String[COLD_URI_COUNT];
+        for (int index = 0; index < COLD_URI_COUNT; index++) {
+            coldUris[index] = "/catalog/books/" + index;
+        }
+        reverseParameters = new HashMap<>();
+        reverseParameters.put("category", "books");
+        reverseParameters.put("id", "42");
+        assertFixtureMatches();
+        holder.match(WARM_URI);
+    }
+
+    // A mappings DSL mistake makes match() return null rather than raise, which would leave these
+    // benchmarks quietly timing failed lookups. Fail the run instead of publishing wrong numbers.
+    private void assertFixtureMatches() {
+        UrlMappingInfo info = holder.match(WARM_URI);
+        if (info == null) {
+            throw new IllegalStateException("URL mappings fixture does not match " + WARM_URI);
+        }
+        if (!"catalog".equals(info.getControllerName()) || !"show".equals(info.getActionName())) {
+            throw new IllegalStateException("Unexpected mapping for " + WARM_URI + ": " + info);
+        }
+        String reverse = holder.getReverseMapping("catalog", "show", reverseParameters)
+                .createRelativeURL("catalog", "show", reverseParameters, "UTF-8");
+        if (!EXPECTED_REVERSE_URL.equals(reverse)) {
+            throw new IllegalStateException("Unexpected reverse URL: " + reverse);
+        }
+    }
+
+    @Benchmark
+    public UrlMappingInfo matchWarmCache() {
+        return holder.match(WARM_URI);
+    }
+
+    @Benchmark
+    public UrlMappingInfo matchColdVariedKeys() {
+        String uri = coldUris[coldUriIndex++ & (COLD_URI_COUNT - 1)];
+        return holder.match(uri);
+    }
+
+    @Benchmark
+    public String reverseMappingAndCreateRelativeUrl() {
+        UrlCreator creator = holder.getReverseMapping("catalog", "show", reverseParameters);
+        return creator.createRelativeURL("catalog", "show", reverseParameters, "UTF-8");
+    }
+}
diff --git a/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/views/ViewTemplateRenderingBenchmark.java b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/views/ViewTemplateRenderingBenchmark.java
new file mode 100644
index 0000000000..ce134e7761
--- /dev/null
+++ b/grails-benchmarks/src/jmh/java/org/apache/grails/benchmarks/views/ViewTemplateRenderingBenchmark.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.views;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import groovy.text.Template;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Measures rendering of already-created JSON and markup view templates, which is the per-request
+ * response path. Regressions here directly delay API and server-rendered view responses.
+ */
+@State(Scope.Benchmark)
+@Threads(1)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 2, jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-XX:+UseG1GC"})
+public class ViewTemplateRenderingBenchmark {
+
+    private Template jsonTemplate;
+    private Template markupTemplate;
+    private Map<String, Object> jsonModel;
+    private Map<String, Object> markupModel;
+
+    @Setup
+    public void setup() {
+        jsonTemplate = ViewTemplateFixture.createJsonTemplate();
+        markupTemplate = ViewTemplateFixture.createMarkupTemplate();
+        jsonModel = Map.of("name", "Ada", "count", 42);
+        markupModel = Map.of("make", "Audi", "trim", "A5");
+    }
+
+    @Benchmark
+    public String renderJsonTemplate() throws IOException {
+        StringWriter writer = new StringWriter();
+        jsonTemplate.make(jsonModel).writeTo(writer);
+        return writer.toString();
+    }
+
+    @Benchmark
+    public String renderMarkupTemplate() throws IOException {
+        StringWriter writer = new StringWriter();
+        markupTemplate.make(markupModel).writeTo(writer);
+        return writer.toString();
+    }
+}
diff --git a/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/interceptors/InterceptorFixture.groovy b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/interceptors/InterceptorFixture.groovy
new file mode 100644
index 0000000000..b0f14371ce
--- /dev/null
+++ b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/interceptors/InterceptorFixture.groovy
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.interceptors
+
+import grails.artefact.Interceptor
+
+class InterceptorFixture {
+
+    static Interceptor createInterceptor() {
+        new BenchmarkInterceptor()
+    }
+}
+
+class BenchmarkInterceptor implements Interceptor {
+}
diff --git a/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/urlmappings/UrlMappingsFixture.groovy b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/urlmappings/UrlMappingsFixture.groovy
new file mode 100644
index 0000000000..d02dcb2bae
--- /dev/null
+++ b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/urlmappings/UrlMappingsFixture.groovy
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.urlmappings
+
+import grails.web.mapping.UrlMapping
+import org.grails.web.mapping.DefaultUrlMappingEvaluator
+import org.grails.web.mapping.DefaultUrlMappingsHolder
+
+class UrlMappingsFixture {
+
+    static DefaultUrlMappingsHolder createHolder() {
+        DefaultUrlMappingEvaluator evaluator = new DefaultUrlMappingEvaluator(null)
+        // These MUST be double-quoted GStrings, exactly as a real UrlMappings.groovy is written.
+        // The DSL captures variables by letting its delegate resolve $category and friends; with
+        // single quotes they stay literal text, every mapping becomes a fixed path, and match()
+        // silently returns null so the benchmark measures failed lookups.
+        List<UrlMapping> mappings = evaluator.evaluateMappings {
+            "/catalog/$category/$id"(controller: 'catalog', action: 'show')
+            "/catalog/search/$query"(controller: 'catalog', action: 'search')
+            "/articles/$year/$month?/$slug"(controller: 'article', action: 'show')
+            "/$controller/$action?/$id?"()
+        }
+        new DefaultUrlMappingsHolder(mappings)
+    }
+}
diff --git a/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/views/ViewTemplateFixture.groovy b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/views/ViewTemplateFixture.groovy
new file mode 100644
index 0000000000..87d8bc9155
--- /dev/null
+++ b/grails-benchmarks/src/main/groovy/org/apache/grails/benchmarks/views/ViewTemplateFixture.groovy
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.grails.benchmarks.views
+
+import grails.plugin.json.view.JsonViewTemplateEngine
+import grails.plugin.markup.view.MarkupViewTemplateEngine
+import groovy.text.Template
+
+class ViewTemplateFixture {
+
+    static Template createJsonTemplate() {
+        new JsonViewTemplateEngine().createTemplate('''
+model {
+    String name
+    Integer count
+}
+json {
+    name name
+    count count
+}
+''')
+    }
+
+    // A model property named `model` fails to compile: the generated template extends
+    // groovy.text.markup.BaseTemplate, whose getModel() returns Map, so `String model`
+    // becomes an incompatible override.
+    static Template createMarkupTemplate() {
+        new MarkupViewTemplateEngine().createTemplate('''
+model {
+    String make
+    String trim
+}
+car(make: make, trim: trim)
+''')
+    }
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Benchmark.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Benchmark.groovy
new file mode 100644
index 0000000000..0ac15e48d9
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Benchmark.groovy
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.transform.CompileStatic
+import groovy.transform.Immutable
+
+@CompileStatic
+@Immutable
+class Benchmark {
+    String identity
+    Double score
+    Double error
+    List<Double> confidence
+    String unit
+    String mode
+    Double allocation
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/BenchmarkComparator.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/BenchmarkComparator.groovy
new file mode 100644
index 0000000000..a5930acd38
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/BenchmarkComparator.groovy
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BenchmarkComparator {
+    static final String RULER_PACKAGE = 'org.apache.grails.benchmarks.ruler.'
+
+    static boolean comparable(Benchmark head, Benchmark base) {
+        return !head.mode.isEmpty() && !base.mode.isEmpty() && head.mode.equalsIgnoreCase(base.mode) && head.unit.trim().equalsIgnoreCase(base.unit.trim())
+    }
+
+    static Double speedup(Benchmark head, Benchmark base) {
+        if (head.score == null || base.score == null || head.score <= 0D || base.score <= 0D || !comparable(head, base)) {
+            return null
+        }
+        return head.unit.toLowerCase(Locale.ROOT).startsWith('ops') ? head.score / base.score : base.score / head.score
+    }
+
+    static boolean disjoint(Benchmark head, Benchmark base) {
+        return head.confidence != null && base.confidence != null && (head.confidence[1] < base.confidence[0] || base.confidence[1] < head.confidence[0])
+    }
+
+    static String group(String identity) {
+        List<String> parts = identity.split('\\[', 2)[0].split('\\.') as List<String>
+        if (parts.size() >= 3) {
+            return parts[parts.size() - 3]
+        }
+        if (parts.size() >= 2) {
+            return parts[parts.size() - 2]
+        }
+        return parts[parts.size() - 1]
+    }
+
+    static Comparison compare(Map<String, Benchmark> head, Map<String, Benchmark> base, double threshold) {
+        List<ComparisonRow> rows = []
+        int malformed = 0
+        Map<String, List<Double>> groups = new TreeMap<>()
+        List<List<Object>> rulers = []
+        List<String> common = (head.keySet().intersect(base.keySet()) as List<String>).sort()
+        double regression = 1D / (1D + threshold)
+        common.each { String identity ->
+            Benchmark h = head.get(identity)
+            Benchmark b = base.get(identity)
+            Double value = speedup(h, b)
+            if (value == null || !Double.isFinite(value) || value <= 0D) {
+                malformed++
+                return
+            }
+            boolean ruler = identity.split('\\[', 2)[0].startsWith(RULER_PACKAGE)
+            Double delta = h.allocation != null && b.allocation != null && b.allocation > 0D ? h.allocation - b.allocation : null
+            Double percent = delta != null ? delta / b.allocation : null
+            boolean candidate = delta != null && percent != null && delta > 16D && percent > .05D
+            String verdict = ruler ? 'ruler - excluded' : h.confidence == null || b.confidence == null ? 'insufficient data' : value <= regression && disjoint(h, b) ? 'REGRESSED' : value >= 1D + threshold && disjoint(h, b) ? 'IMPROVED' : 'no clear change'
+            if (ruler) {
+                rulers.add([identity, value])
+            } else {
+                groups.computeIfAbsent(group(identity)) { [] }.add(value)
+            }
+            rows.add(new ComparisonRow(identity, b, h, value, verdict, delta, percent, candidate))
+        }
+        Map<String, List<Object>> means = new TreeMap<>()
+        groups.each { String name, List<Double> values ->
+            Double mean = geometricMean(values)
+            if (mean != null) {
+                means.put(name, [mean, values.size()])
+            }
+        }
+        return new Comparison(rows, (head.keySet() - base.keySet()).sort(), (base.keySet() - head.keySet()).sort(), malformed, means, rulers.sort { List<Object> item -> (String) item[0] }, [], [], [], [], [])
+    }
+
+    static Comparison compareShards(Map<String, Map<String, Benchmark>> head, Map<String, Map<String, Benchmark>> base, double threshold, List<String> expected = []) {
+        Map<String, List<Benchmark>> headSamples = new TreeMap<>()
+        Map<String, List<Benchmark>> baseSamples = new TreeMap<>()
+        Set<String> dropped = new TreeSet<>()
+        Set<String> rulers = new TreeSet<>()
+        List<String> paired = (head.keySet().intersect(base.keySet()) as List<String>).sort()
+        paired.each { String shard ->
+            Map<String, Benchmark> h = head.get(shard)
+            Map<String, Benchmark> b = base.get(shard)
+            dropped.addAll(h.keySet() - b.keySet())
+            dropped.addAll(b.keySet() - h.keySet())
+            (h.keySet() + b.keySet()).findAll { String id -> id.split('\\[', 2)[0].startsWith(RULER_PACKAGE) }.each { String id -> rulers.add(id) }
+            h.keySet().intersect(b.keySet()).each { String id -> headSamples.computeIfAbsent(id) { [] }.add(h.get(id)); baseSamples.computeIfAbsent(id) { [] }.add(b.get(id)) }
+        }
+        [head, base].each { Map<String, Map<String, Benchmark>> all -> (all.keySet() - paired).each { String shard -> dropped.addAll(all.get(shard).keySet()) } }
+        List<RulerDeviation> deviations = []
+        List<String> incomplete = []
+        paired.each { String shard -> rulers.each { String id ->
+            Benchmark h = head.get(shard).get(id)
+            Benchmark b = base.get(shard).get(id)
+            Double value = h != null && b != null ? speedup(h, b) : null
+            if (value == null || !Double.isFinite(value) || value <= 0D) incomplete.add("${shard}: ${id}".toString())
+            else deviations.add(new RulerDeviation(shard, id, value))
+        } }
+        Comparison comparison = compare(headSamples.collectEntries { String id, List<Benchmark> samples -> [(id): JmhResults.poolBenchmarks(samples)] }, baseSamples.collectEntries { String id, List<Benchmark> samples -> [(id): JmhResults.poolBenchmarks(samples)] }, threshold)
+        Set<String> missing = new TreeSet<>(expected.findAll { String shard -> !paired.contains(shard) })
+        missing.addAll((head.keySet() - base.keySet()) - paired)
+        missing.addAll((base.keySet() - head.keySet()) - paired)
+        return new Comparison(comparison.rows, comparison.onlyHead, comparison.onlyBase, comparison.malformed, comparison.groupSpeedups, comparison.rulerSpeedups, dropped as List<String>, deviations.sort { RulerDeviation item -> item.shard + item.identity }, incomplete.sort(), missing as List<String>, paired)
+    }
+
+    static Double geometricMean(List<Double> values) {
+        if (values.isEmpty() || values.any { Double value -> value <= 0D || !Double.isFinite(value) }) {
+            return null
+        }
+        double sum = 0D
+        values.each { Double value -> sum += Math.log(value) }
+        return Math.exp(sum / values.size())
+    }
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/CommentPoster.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/CommentPoster.groovy
new file mode 100644
index 0000000000..4ce9a2f468
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/CommentPoster.groovy
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import groovy.transform.CompileStatic
+
+import java.net.URI
+import java.net.http.HttpClient
+import java.net.http.HttpRequest
+import java.net.http.HttpResponse
+import java.time.Duration
+
+@CompileStatic
+interface CommentPoster {
+    void post(String report, String repo, String prNumber, String token)
+}
+
+@CompileStatic
+class GitHubComments implements CommentPoster {
+    static final int MAX_BODY = 65000
+    static final String TRUNCATION = '\n\n_Report truncated. The full report is available in the workflow artifacts._\n\n<!-- grails-jmh-benchmark -->'
+    private final HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(15)).build()
+
+    @Override
+    void post(String report, String repo, String prNumber, String token) {
+        String body = commentBody(report)
+        Long commentId = null
+        for (int page = 1; page <= 100; page++) {
+            Object response = request(
+                    "https://api.github.com/repos/${repo}/issues/${prNumber}/comments?per_page=100&page=${page}",
+                    token,
+                    'GET',
+                    null)
+            if (!(response instanceof List)) {
+                break
+            }
+            List<?> comments = (List<?>) response
+            Long pageMatch = latestMatchingCommentId(comments)
+            if (pageMatch != null) {
+                commentId = pageMatch
+            }
+            if (comments.size() < 100) {
+                break
+            }
+        }
+        String endpoint = commentId == null
+                ? "https://api.github.com/repos/${repo}/issues/${prNumber}/comments"
+                : "https://api.github.com/repos/${repo}/issues/comments/${commentId}"
+        request(endpoint, token, commentId == null ? 'POST' : 'PATCH', JsonOutput.toJson([body: body]))
+    }
+
+    /**
+     * Keep the last matching comment on a page so duplicate marker comments update the
+     * newest bot report (GitHub returns comments oldest-first).
+     */
+    static Long latestMatchingCommentId(List<?> comments) {
+        Long commentId = null
+        for (Object comment : comments) {
+            if (!(comment instanceof Map) || !markerComment((Map<String, Object>) comment)) {
+                continue
+            }
+            Object id = ((Map<String, Object>) comment).get('id')
+            if (id instanceof Number) {
+                commentId = ((Number) id).longValue()
+            }
+        }
+        return commentId
+    }
+
+    static String commentBody(String report) {
+        String body = report.contains(ReportRenderer.MARKER)
+                ? report
+                : report + '\n\n' + ReportRenderer.MARKER
+        if (body.length() > MAX_BODY) {
+            body = body.substring(0, MAX_BODY - TRUNCATION.length()) + TRUNCATION
+        }
+        return body
+    }
+
+    private static boolean markerComment(Map<String, Object> comment) {
+        Object body = comment.get('body')
+        Object user = comment.get('user')
+        Object login = user instanceof Map ? ((Map<String, Object>) user).get('login') : null
+        return body instanceof String && ((String) body).contains(ReportRenderer.MARKER) && (!(login instanceof String) || login == 'github-actions[bot]')
+    }
+
+    private Object request(String url, String token, String method, String body) {
+        HttpRequest.Builder builder = HttpRequest.newBuilder(URI.create(url)).timeout(Duration.ofSeconds(15)).header('Accept', 'application/vnd.github+json').header('Authorization', "Bearer ${token}").header('Content-Type', 'application/json').header('X-GitHub-Api-Version', '2022-11-28')
+        HttpRequest request = body == null ? builder.method(method, HttpRequest.BodyPublishers.noBody()).build() : builder.method(method, HttpRequest.BodyPublishers.ofString(body)).build()
+        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString())
+        if (response.statusCode() >= 400) throw new IOException("GitHub HTTP ${response.statusCode()}")
+        return new JsonSlurper().parseText(response.body())
+    }
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Comparison.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Comparison.groovy
new file mode 100644
index 0000000000..3de971d2df
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/Comparison.groovy
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.transform.CompileStatic
+import groovy.transform.Immutable
+
+@CompileStatic
+@Immutable
+class ComparisonRow {
+    String identity
+    Benchmark base
+    Benchmark head
+    Double speedup
+    String verdict
+    Double allocationDelta
+    Double allocationPercent
+    boolean allocationCandidate
+}
+
+@CompileStatic
+@Immutable
+class RulerDeviation {
+    String shard
+    String identity
+    double speedup
+}
+
+@CompileStatic
+@Immutable
+class Comparison {
+    List<ComparisonRow> rows
+    List<String> onlyHead
+    List<String> onlyBase
+    int malformed
+    Map<String, List<Object>> groupSpeedups
+    List<List<Object>> rulerSpeedups
+    List<String> dropped = []
+    List<RulerDeviation> rulerDeviations = []
+    List<String> rulerIncomplete = []
+    List<String> missingShards = []
+    List<String> pairedShards = []
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhCompare.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhCompare.groovy
new file mode 100644
index 0000000000..e084d4005f
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhCompare.groovy
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.transform.CompileStatic
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.Files
+import java.nio.file.Path
+
+@CompileStatic
+class JmhCompare {
+    static void main(String[] args) {
+        int exit = run(args, new GitHubComments())
+        if (exit != 0) {
+            System.exit(exit)
+        }
+    }
+
+    static int run(String[] args, CommentPoster poster) {
+        return run(args, poster, System.getenv())
+    }
+
+    static int run(String[] args, CommentPoster poster, Map<String, String> environment) {
+        try {
+            Map<String, String> options = parse(args)
+            if (options.containsKey('post-file')) {
+                return postFile(options, poster, environment)
+            }
+            double threshold = options.containsKey('threshold') ? Double.parseDouble(options.get('threshold')) : .10D
+            if (!Double.isFinite(threshold) || threshold <= 0D) {
+                throw new IllegalArgumentException('--threshold must be greater than zero')
+            }
+            String headPath = options.get('head')
+            if (!headPath) {
+                throw new IllegalArgumentException('--head is required')
+            }
+            Map<String, Map<String, Benchmark>> head = JmhResults.readShards(headPath)
+            String basePath = options.get('base')
+            String report = basePath && Files.exists(Path.of(basePath))
+                    ? ReportRenderer.render(BenchmarkComparator.compareShards(head, JmhResults.readShards(basePath), threshold,
+                    options.getOrDefault('expected-shards', '').split(',').findAll { String value -> !value.trim().isEmpty() }))
+                    : ReportRenderer.headOnly(JmhResults.poolShards(head))
+            System.out.println(report)
+            if (options.containsKey('output')) {
+                Files.writeString(Path.of(options.get('output')), report + '\n', StandardCharsets.UTF_8)
+            }
+            postWhenConfigured(report, options, poster, environment)
+            return 0
+        } catch (Exception error) {
+            System.err.println("error: ${error.message}")
+            return 2
+        }
+    }
+
+    private static int postFile(Map<String, String> options, CommentPoster poster, Map<String, String> environment) {
+        if (options.containsKey('head')) {
+            throw new IllegalArgumentException('--post-file cannot be used with --head')
+        }
+        String report = Files.readString(Path.of(options.get('post-file')), StandardCharsets.UTF_8)
+        postWhenConfigured(report, options, poster, environment)
+        return 0
+    }
+
+    private static void postWhenConfigured(String report, Map<String, String> options, CommentPoster poster, Map<String, String> environment) {
+        String pr = options.getOrDefault('pr-number', '').trim()
+        String repo = options.get('repo')
+        String token = environment.get('GITHUB_TOKEN')
+        if (!pr || pr == 'null' || !repo || !token) {
+            if (options.containsKey('post-file')) {
+                System.err.println('warning: --post-file requires --repo, --pr-number, and GITHUB_TOKEN; skipping comment post')
+            }
+            return
+        }
+        try {
+            poster.post(report, repo, pr, token)
+        } catch (Exception error) {
+            System.err.println("warning: unable to post JMH report: ${error.message}")
+        }
+    }
+
+    private static Map<String, String> parse(String[] args) {
+        Set<String> values = ['head', 'base', 'threshold', 'repo', 'pr-number', 'expected-shards', 'output', 'post-file'] as Set<String>
+        Map<String, String> options = new LinkedHashMap<>()
+        for (int index = 0; index < args.length; index++) {
+            String option = args[index]
+            if (!option.startsWith('--')) {
+                throw new IllegalArgumentException("unknown option: ${option}")
+            }
+            String key = option.substring(2)
+            if (key == 'fail-on-regression') {
+                options.put(key, 'true')
+                continue
+            }
+            if (!values.contains(key) || index + 1 >= args.length) {
+                throw new IllegalArgumentException("missing value for --${key}")
+            }
+            options.put(key, args[++index])
+        }
+        return options
+    }
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhResults.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhResults.groovy
new file mode 100644
index 0000000000..e8ef2c3909
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/JmhResults.groovy
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.json.JsonSlurper
+import groovy.transform.CompileStatic
+
+import java.nio.file.Files
+import java.nio.file.Path
+
+@CompileStatic
+class JmhResults {
+    static final String ALLOCATION_METRIC = 'gc.alloc.rate.norm'
+
+    static Double finiteNumber(Object value) {
+        if (value == null) {
+            return null
+        }
+        try {
+            Double number = Double.valueOf(value.toString())
+            return Double.isFinite(number) ? number : null
+        } catch (NumberFormatException ignored) {
+            return null
+        }
+    }
+
+    static List<Double> confidenceInterval(Map<String, Object> metric) {
+        Object value = metric.get('scoreConfidence')
+        if (value instanceof List && ((List<?>) value).size() == 2) {
+            Double lower = finiteNumber(((List<?>) value).get(0))
+            Double upper = finiteNumber(((List<?>) value).get(1))
+            if (lower != null && upper != null) {
+                return [Math.min(lower, upper), Math.max(lower, upper)]
+            }
+        }
+        Double score = finiteNumber(metric.get('score'))
+        Double error = finiteNumber(metric.get('scoreError'))
+        return score != null && error != null && error >= 0D ? [score - error, score + error] : null
+    }
+
+    static String identity(String name, Map<String, Object> params) {
+        if (params == null || params.isEmpty()) {
+            return name
+        }
+        List<String> keys = new ArrayList<>(params.keySet())
+        keys.sort()
+        return name + '[' + keys.collect { String key -> key + '=' + params.get(key) }.join(',') + ']'
+    }
+
+    static Map<String, Benchmark> parseEntries(List<?> entries) {
+        Map<String, Benchmark> benchmarks = new LinkedHashMap<>()
+        entries.each { Object entry ->
+            if (!(entry instanceof Map)) {
+                return
+            }
+            Map<String, Object> item = (Map<String, Object>) entry
+            Object name = item.get('benchmark')
+            Object metricValue = item.get('primaryMetric')
+            if (!(name instanceof String) || !(metricValue instanceof Map)) {
+                return
+            }
+            Map<String, Object> metric = (Map<String, Object>) metricValue
+            Map<String, Object> params = item.get('params') instanceof Map ? (Map<String, Object>) item.get('params') : null
+            Map<String, Object> secondary = item.get('secondaryMetrics') instanceof Map ? (Map<String, Object>) item.get('secondaryMetrics') : null
+            Map<String, Object> allocationMetric = secondary?.get(ALLOCATION_METRIC) instanceof Map ? (Map<String, Object>) secondary.get(ALLOCATION_METRIC) : null
+            Double allocation = allocationMetric?.get('scoreUnit') == 'B/op' ? finiteNumber(allocationMetric.get('score')) : null
+            String mode = item.get('mode') instanceof String ? ((String) item.get('mode')).trim() : ''
+            String benchmarkId = identity((String) name, params)
+            benchmarks.put(benchmarkId, new Benchmark(benchmarkId, finiteNumber(metric.get('score')), finiteNumber(metric.get('scoreError')), confidenceInterval(metric), String.valueOf(metric.getOrDefault('scoreUnit', '')), mode, allocation))
+        }
+        return benchmarks
+    }
+
+    static Map<String, Map<String, Benchmark>> readShards(String location) {
+        Path input = Path.of(location)
+        List<Path> paths = Files.isDirectory(input)
+                ? Files.list(input).withCloseable { stream ->
+                    stream.filter { Path path -> path.fileName.toString().endsWith('.json') }.sorted().toList()
+                }
+                : [input]
+        Map<String, Map<String, Benchmark>> shards = new LinkedHashMap<>()
+        paths.each { Path path ->
+            Object parsed = new JsonSlurper().parse(path.toFile())
+            if (!(parsed instanceof List)) {
+                throw new IllegalArgumentException("JMH JSON must be an array: ${path}")
+            }
+            shards.put(Files.isDirectory(input) ? path.fileName.toString() : 'anonymous shard', parseEntries((List<?>) parsed))
+        }
+        return shards
+    }
+
+    static Map<String, Benchmark> readResults(String location) {
+        return poolShards(readShards(location))
+    }
+
+    static Map<String, Benchmark> poolShards(Map<String, Map<String, Benchmark>> shards) {
+        Map<String, List<Benchmark>> samples = new TreeMap<>()
+        shards.values().each { Map<String, Benchmark> shard -> shard.each { String key, Benchmark value -> samples.computeIfAbsent(key) { [] }.add(value) } }
+        return samples.collectEntries { String key, List<Benchmark> value -> [(key): poolBenchmarks(value)] }
+    }
+
+    static Benchmark poolBenchmarks(List<Benchmark> samples) {
+        if (samples.size() == 1) {
+            return samples[0]
+        }
+        Benchmark first = samples[0]
+        if (samples.any { Benchmark sample -> sample.unit != first.unit || sample.mode != first.mode }) {
+            return new Benchmark(first.identity, null, null, null, first.unit, first.mode, null)
+        }
+        List<List<Double>> intervals = samples.collect { Benchmark sample -> sample.confidence }.findAll { List<Double> interval -> interval != null }
+        List<Double> confidence = intervals.size() == samples.size() ? [intervals.collect { List<Double> interval -> interval[0] }.min(), intervals.collect { List<Double> interval -> interval[1] }.max()] : null
+        return new Benchmark(first.identity, mean(samples.collect { Benchmark sample -> sample.score }), mean(samples.collect { Benchmark sample -> sample.error }), confidence, first.unit, first.mode, mean(samples.collect { Benchmark sample -> sample.allocation }))
+    }
+
+    static Double mean(List<Double> values) {
+        List<Double> present = values.findAll { Double value -> value != null }
+        if (present.isEmpty()) {
+            return null
+        }
+        double sum = 0D
+        present.each { Double value -> sum += value }
+        return sum / present.size()
+    }
+}
diff --git a/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/ReportRenderer.groovy b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/ReportRenderer.groovy
new file mode 100644
index 0000000000..f89d5920a6
--- /dev/null
+++ b/grails-benchmarks/src/report/groovy/org/apache/grails/benchmarks/report/ReportRenderer.groovy
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import groovy.transform.CompileStatic
+
+import java.util.Comparator
+import java.util.Locale
+
+@CompileStatic
+class ReportRenderer {
+    static final String MARKER = '<!-- grails-jmh-benchmark -->'
+    static final String DASH = '—'
+    static final String BENCHMARK_PACKAGE = 'org.apache.grails.benchmarks.'
+
+    static String safe(String value) {
+        value.replaceAll('[`|<>\\[\\]\\(\\)!\\r\\n]', '')
+    }
+
+    static String number(Double value) {
+        if (value == null || !Double.isFinite(value)) {
+            return DASH
+        }
+        String rendered = String.format(Locale.ROOT, '%.3g', value)
+        int exponent = rendered.indexOf('e')
+        String mantissa = exponent >= 0 ? rendered.substring(0, exponent) : rendered
+        String suffix = exponent >= 0 ? rendered.substring(exponent) : ''
+        if (mantissa.contains('.')) {
+            mantissa = mantissa.replaceFirst('0+$', '').replaceFirst('\\.$', '')
+        }
+        return mantissa + suffix
+    }
+
+    static String speedup(Double value) {
+        value != null && Double.isFinite(value)
+                ? String.format(Locale.ROOT, '%.2fx', value)
+                : DASH
+    }
+
+    static String identity(String value) {
+        safe(removePrefix(value, BENCHMARK_PACKAGE))
+    }
+
+    static String score(Benchmark value) {
+        String rendered = number(value.score)
+        rendered == DASH ? DASH : rendered + ' ' + safe(value.unit)
+    }
+
+    static String allocation(ComparisonRow row) {
+        if (row.allocationDelta == null || row.allocationPercent == null) {
+            return DASH
+        }
+        if (Math.abs(row.allocationDelta) < 1D) {
+            return '~0 B/op'
+        }
+        return String.format(Locale.ROOT, '%+,.0f B/op (%+.1f%%)%s',
+                row.allocationDelta,
+                row.allocationPercent * 100D,
+                row.allocationCandidate ? ' **candidate**' : '')
+    }
+
+    static String render(Comparison comparison) {
+        int regressions = comparison.rows.count { ComparisonRow row -> row.verdict == 'REGRESSED' }.intValue()
+        int improvements = comparison.rows.count { ComparisonRow row -> row.verdict == 'IMPROVED' }.intValue()
+        List<RulerDeviation> deviations = comparison.rulerDeviations ?: comparison.rulerSpeedups.collect { List<Object> item -> new RulerDeviation('', (String) item[0], (Double) item[1]) }
+        RulerDeviation worst = deviations ? deviations.max { RulerDeviation item -> deviation(item.speedup) } : null
+        String health = comparison.rulerIncomplete
+                ? 'INCOMPLETE/unreliable (missing or non-finite ruler measurements)'
+                : worst == null
+                        ? 'not measured'
+                        : "worst ruler deviation: ${String.format(Locale.ROOT, '%.1f%%', deviation(worst.speedup) * 100D)}${worst.shard ? ' in ' + safe(worst.shard) : ''} (${safe(removePrefix(worst.identity, BenchmarkComparator.RULER_PACKAGE))})"
+        List<String> lines = ['### JMH Benchmark Report', '', "**Regressions:** ${regressions}".toString(), "**Improvements:** ${improvements}".toString(), "**Runner health:** ${health}".toString(), 'Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.']
+        if (comparison.missingShards) lines.addAll(['', '> **Warning:** No usable base/head pair was produced by ' + comparison.missingShards.collect { String item -> safe(item) }.join(', ') + ". This comparison rests on ${comparison.pairedShards.size()} shard pair(s) instead of the expected ${comparison.pairedShards.size() + comparison.missingShards.size()}, so the alternating measurement order did not fully cancel and the result is weaker than a normal run."])
+        if (deviations) {
+            lines.add('**Ruler movements:** ' + deviations.collect { RulerDeviation item ->
+                (item.shard ? safe(item.shard) + ': ' : '') +
+                        safe(removePrefix(item.identity, BenchmarkComparator.RULER_PACKAGE)) +
+                        ': ' + speedup(item.speedup)
+            }.join(', '))
+        }
+        if (comparison.rulerIncomplete) lines.addAll(['', '> **Warning:** Runner health is INCOMPLETE because expected ruler measurements were missing or non-finite. Treat results as unreliable.', '', '**Incomplete ruler measurements:** ' + comparison.rulerIncomplete.collect { String item -> safe(item) }.join(', ')])
+        if (deviations.any { RulerDeviation item -> Math.max(item.speedup, 1D / item.speedup) > 1.05D }) lines.addAll(['', '> **Warning:** The runner was unstable BETWEEN the two halves of the A/B run. Treat results as unreliable. Runner health is a stability check, not a calibration factor.'])
+        lines.addAll(['', 'Group geometric means are descriptive only, not verdicts.', ''])
+        if (comparison.groupSpeedups) {
+            lines.addAll(['| Group | Descriptive geomean speedup | n |', '| --- | ---: | ---: |'])
+            comparison.groupSpeedups.each { String group, List<Object> value ->
+                lines.add("| ${safe(group)} | ${speedup((Double) value[0])} | ${value[1]} |".toString())
+            }
+        } else {
+            lines.add('No comparable non-ruler benchmarks were available for group summaries.')
+        }
+        lines.addAll(['', '<details>', '<summary>Per-benchmark results</summary>', '', '| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |', '| --- | ---: | ---: | ---: | --- | ---: |'])
+        List<ComparisonRow> sortedRows = new ArrayList<>(comparison.rows)
+        Comparator<ComparisonRow> rowOrder = Comparator
+                .comparingInt { ComparisonRow row -> verdictRank(row.verdict) }
+                .thenComparing { ComparisonRow row -> row.identity }
+        sortedRows.sort(rowOrder)
+        sortedRows.each { ComparisonRow row -> lines.add("| ${identity(row.identity)} | ${score(row.base)} | ${score(row.head)} | ${speedup(row.speedup)} | ${row.verdict} | ${allocation(row)} |".toString()) }
+        lines.addAll(['', '</details>'])
+        if (comparison.onlyHead) lines.addAll(['', '**Only in head:** ' + comparison.onlyHead.collect { String item -> safe(item) }.join(', ')])
+        if (comparison.onlyBase) lines.addAll(['', '**Only in base:** ' + comparison.onlyBase.collect { String item -> safe(item) }.join(', ')])
+        if (comparison.dropped) {
+            lines.add('')
+            lines.add(("**Dropped unpaired shard samples (${comparison.dropped.size()}):** " + comparison.dropped.collect { String item -> safe(item) }.join(', ')).toString())
+        }
+        if (comparison.malformed) {
+            lines.add('')
+            lines.add("**Malformed comparisons skipped:** ${comparison.malformed}".toString())
+        }
+        return lines.join('\n') + '\n\n' + MARKER
+    }
+
+    static String headOnly(Map<String, Benchmark> head) {
+        List<String> lines = ['### JMH Benchmark Report', '', '**Regressions:** 0 (no base)', '**Improvements:** 0 (no base)', '**Runner health:** not measured (no base)', '', 'No comparison was possible because the base revision has no benchmark harness.', '', '| Benchmark | Head score | Error | Unit |', '| --- | ---: | ---: | --- |']
+        head.values().sort { Benchmark item -> item.identity }.each { Benchmark item -> lines.add("| ${identity(item.identity)} | ${number(item.score)} | ${number(item.error)} | ${safe(item.unit)} |".toString()) }
+        return lines.join('\n') + '\n\n' + MARKER
+    }
+
+    static double deviation(double value) {
+        Math.max(value, 1D / value) - 1D
+    }
+
+    private static int verdictRank(String verdict) {
+        if (verdict == 'REGRESSED') {
+            return 0
+        }
+        if (verdict == 'IMPROVED') {
+            return 1
+        }
+        return 2
+    }
+
+    private static String removePrefix(String value, String prefix) {
+        value.startsWith(prefix) ? value.substring(prefix.length()) : value
+    }
+}
diff --git a/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/BenchmarkComparatorSpec.groovy b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/BenchmarkComparatorSpec.groovy
new file mode 100644
index 0000000000..1c22868ab9
--- /dev/null
+++ b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/BenchmarkComparatorSpec.groovy
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import spock.lang.Specification
+
+class BenchmarkComparatorSpec extends Specification {
+    def "speedup follows throughput direction"() { expect: BenchmarkComparator.speedup(item(120D, 'ops/s'), item(100D, 'ops/s')) == 1.2D }
+    def "speedup follows latency direction"() { expect: BenchmarkComparator.speedup(item(100D), item(120D)) == 1.2D }
+    def "large disjoint latency change regresses"() { expect: compare(item(120D, 'ns/op', [119D, 121D]), item(100D, 'ns/op', [99D, 101D])).rows[0].verdict == 'REGRESSED' }
+    def "overlapping intervals suppress a large change"() { expect: compare(item(120D, 'ns/op', [95D, 125D]), item(100D, 'ns/op', [90D, 121D])).rows[0].verdict == 'no clear change' }
+    def "small effect suppresses a disjoint change"() { expect: compare(item(105D, 'ns/op', [104D, 106D]), item(100D, 'ns/op', [99D, 101D])).rows[0].verdict == 'no clear change' }
+    def "score error supplies a confidence interval"() { expect: JmhResults.confidenceInterval([score: 120D, scoreError: 1D]) == [119D, 121D] }
+    def "missing interval is insufficient data"() { expect: compare(item(120D, 'ns/op', null, null), item(100D, 'ns/op', null, null)).rows[0].verdict == 'insufficient data' }
+    def "nan score error is unavailable"() { expect: JmhResults.confidenceInterval([score: 100D, scoreError: 'NaN']) == null }
+    def "one-sided benchmarks are excluded"() { expect: BenchmarkComparator.compare(['a': item(100D), 'head': item(100D)], ['a': item(100D), 'base': item(100D)], .1D).with { rows.size() == 1 && onlyHead == ['head'] && onlyBase == ['base'] } }
+    def "identity sorts parameters"() { expect: JmhResults.identity('sample.Run', [z: '2', a: '1']) == 'sample.Run[a=1,z=2]' }
+    def "invalid scores are malformed"() { expect: compare(item(0D), item(100D)).malformed == 1 }
+    def "allocation requires percentage and absolute thresholds"() { expect: compare(item(100D, 'ns/op', [99D, 101D], 1D, 117D), item(100D, 'ns/op', [99D, 101D], 1D, 100D)).rows[0].allocationCandidate }
+    def "unit changes are not comparable"() { expect: compare(item(5000D, 'ops/s'), item(200D)).malformed == 1 }
+    def "mode changes are not comparable"() { expect: compare(item(100D, 'ns/op', [99D, 101D], 1D, null, 'sample'), item(100D)).malformed == 1 }
+    def "matching mode and unit compare"() { expect: compare(item(120D, 'ns/op', [119D, 121D]), item(100D, 'ns/op', [99D, 101D])).rows[0].verdict == 'REGRESSED' }
+    def "ruler benchmarks are excluded from verdicts"() { expect: compare(item(80D, 'ns/op', [79D, 81D], 1D, null, 'avgt', 'org.apache.grails.benchmarks.ruler.Cpu.run'), item(100D, 'ns/op', [99D, 101D], 1D, null, 'avgt', 'org.apache.grails.benchmarks.ruler.Cpu.run')).rows[0].verdict == 'ruler - excluded' }
+    def "group uses class name for two-component identities"() {
+        expect:
+        BenchmarkComparator.group('Class.method') == 'Class'
+        BenchmarkComparator.group('pkg.Class.method') == 'pkg'
+        BenchmarkComparator.group('method') == 'method'
+    }
+
+    def "geometric mean handles known speedups"() { expect: BenchmarkComparator.geometricMean([2D, .5D]) == 1D }
+
+    private static Benchmark item(double score, String unit = 'ns/op', List<Double> confidence = [99D, 101D], Double error = 1D, Double allocation = null, String mode = 'avgt', String name = 'sample.Group.run') {
+        new Benchmark(name, score, error, confidence, unit, mode, allocation)
+    }
+
+    private static Comparison compare(Benchmark head, Benchmark base) {
+        BenchmarkComparator.compare([(head.identity): head], [(base.identity): base], .1D)
+    }
+}
diff --git a/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/GoldenReportSpec.groovy b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/GoldenReportSpec.groovy
new file mode 100644
index 0000000000..c04a14d397
--- /dev/null
+++ b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/GoldenReportSpec.groovy
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import spock.lang.Specification
+import spock.lang.TempDir
+import spock.lang.Unroll
+
+import java.nio.file.Files
+import java.nio.file.Path
+
+class GoldenReportSpec extends Specification {
+    @TempDir
+    Path temporaryDirectory
+
+    @Unroll
+    def "#name report exactly matches the Python golden file"() {
+        given:
+        Path output = temporaryDirectory.resolve("${name}.md")
+        String[] arguments = argumentsFor(head, base, output, expectedShards)
+
+        when:
+        int result = JmhCompare.run(arguments, Mock(CommentPoster))
+
+        then:
+        result == 0
+        Files.readString(output) == resource(expected)
+
+        where:
+        name      | head                        | base                        | expected                 | expectedShards
+        'broad'   | 'jmh-golden/broad-head.json' | 'jmh-golden/broad-base.json' | 'jmh-golden/expected-broad.md'   | null
+        'numbers' | 'jmh-golden/numbers-head.json' | 'jmh-golden/numbers-base.json' | 'jmh-golden/expected-numbers.md' | null
+        'edges'   | 'jmh-golden/edges-head.json' | 'jmh-golden/edges-base.json' | 'jmh-golden/expected-edges.md'   | null
+        'norulers' | 'jmh-golden/norulers-head.json' | 'jmh-golden/norulers-base.json' | 'jmh-golden/expected-norulers.md' | null
+        'shards'  | 'jmh-golden/shards-head'     | 'jmh-golden/shards-base'     | 'jmh-golden/expected-shards.md'  | 'shard-a.json,shard-b.json,shard-c.json'
+        'headonly' | 'jmh-golden/broad-head.json' | null                         | 'jmh-golden/expected-headonly.md' | null
+    }
+
+    private String[] argumentsFor(String head, String base, Path output, String expectedShards) {
+        List<String> arguments = ['--head', resourcePath(head).toString(), '--output', output.toString()]
+        if (base != null) {
+            arguments.addAll(['--base', resourcePath(base).toString()])
+        }
+        if (expectedShards != null) {
+            arguments.addAll(['--expected-shards', expectedShards])
+        }
+        arguments as String[]
+    }
+
+    private Path resourcePath(String name) {
+        Path.of(getClass().getClassLoader().getResource(name).toURI())
+    }
+
+    private String resource(String name) {
+        Files.readString(resourcePath(name))
+    }
+}
diff --git a/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/JmhCompareSpec.groovy b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/JmhCompareSpec.groovy
new file mode 100644
index 0000000000..db1044ed61
--- /dev/null
+++ b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/JmhCompareSpec.groovy
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import spock.lang.Specification
+import spock.lang.TempDir
+
+import java.nio.file.Files
+import java.nio.file.Path
+
+class JmhCompareSpec extends Specification {
+    @TempDir Path temporaryDirectory
+
+    def "speedup respects throughput and latency direction"() {
+        expect:
+        BenchmarkComparator.speedup(benchmark(120, 'ops/s'), benchmark(100, 'ops/s')) == 1.2D
+        BenchmarkComparator.speedup(benchmark(100), benchmark(120)) == 1.2D
+    }
+
+    def "verdict requires threshold and disjoint intervals"() {
+        expect:
+        compare(benchmark(120, 'ns/op', [119, 121]), benchmark(100, 'ns/op', [99, 101])).rows[0].verdict == 'REGRESSED'
+        compare(benchmark(120, 'ns/op', [95, 125]), benchmark(100, 'ns/op', [90, 121])).rows[0].verdict == 'no clear change'
+        compare(benchmark(105, 'ns/op', [104, 106]), benchmark(100, 'ns/op', [99, 101])).rows[0].verdict == 'no clear change'
+    }
+
+    def "fallback errors and missing data render correctly"() {
+        given:
+        Benchmark fallbackHead = new Benchmark('sample.Fallback.run', 120D, 1D, [119D, 121D], 'ns/op', 'avgt', null)
+        Benchmark fallbackBase = new Benchmark('sample.Fallback.run', 100D, 1D, [99D, 101D], 'ns/op', 'avgt', null)
+        Benchmark missing = new Benchmark('sample.Fallback.run', 120D, null, null, 'ns/op', 'avgt', null)
+        expect:
+        compare(fallbackHead, fallbackBase).rows[0].verdict == 'REGRESSED'
+        compare(missing, missing).rows[0].verdict == 'insufficient data'
+        !ReportRenderer.render(compare(missing, missing)).toLowerCase().contains('nan')
+    }
+
+    def "identity pooling and incompatible units preserve comparison safety"() {
+        given:
+        Benchmark first = new Benchmark('sample.Run[a=1,z=2]', 100D, 1D, [90D, 110D], 'ns/op', 'avgt', 200D)
+        Benchmark second = new Benchmark('sample.Run[a=1,z=2]', 200D, 1D, [190D, 210D], 'ns/op', 'avgt', 400D)
+        expect:
+        JmhResults.poolBenchmarks([first, second]).with { score == 150D && allocation == 300D && confidence == [90D, 210D] }
+        JmhResults.poolBenchmarks([first, new Benchmark(first.identity, 100D, 1D, [90D, 110D], 'ops/s', 'avgt', null)]).score == null
+        BenchmarkComparator.compare([(first.identity): first], [(first.identity): new Benchmark(first.identity, 100D, 1D, [99D, 101D], 'ops/s', 'avgt', null)], .1D).malformed == 1
+    }
+
+    def "rulers are excluded and strict instability is reported"() {
+        given:
+        String ruler = 'org.apache.grails.benchmarks.ruler.CpuRuler.run'
+        Comparison unstable = compare(new Benchmark(ruler, 100D, 1D, [99D, 101D], 'ns/op', 'avgt', null), new Benchmark(ruler, 90D, 1D, [89D, 91D], 'ns/op', 'avgt', null))
+        expect:
+        unstable.rows[0].verdict == 'ruler - excluded'
+        ReportRenderer.render(unstable).contains('runner was unstable BETWEEN')
+        !ReportRenderer.render(compare(new Benchmark(ruler, 100D, 1D, [99D, 101D], 'ns/op', 'avgt', null), new Benchmark(ruler, 105D, 1D, [104D, 106D], 'ns/op', 'avgt', null))).contains('runner was unstable BETWEEN')
+    }
+
+    def "shards drop unpaired data and expose missing runners"() {
+        given:
+        Benchmark value = benchmark(100)
+        Comparison result = BenchmarkComparator.compareShards(['a.json': ['sample.Run': value]], ['a.json': ['sample.Run': value]], .1D, ['a.json', 'b.json'])
+        expect:
+        result.missingShards == ['b.json']
+        ReportRenderer.render(result).contains('1 shard pair(s) instead of the expected 2')
+    }
+
+    def "number formatting matches Python percent g rendering"() {
+        expect:
+        ReportRenderer.number(value) == rendered
+        where:
+        value    || rendered
+        100D     || '100'
+        4.07D    || '4.07'
+        18300D   || '1.83e+04'
+    }
+
+    def "head only output writes no workflow summary and null PR does not post"() {
+        given:
+        Path json = temporaryDirectory.resolve('head.json')
+        Path output = temporaryDirectory.resolve('report.md')
+        Files.writeString(json, '[{"benchmark":"sample.New.run","mode":"avgt","primaryMetric":{"score":42,"scoreError":1,"scoreUnit":"ns/op"}}]')
+        CommentPoster poster = Mock()
+        when:
+        int code = JmhCompare.run(['--head', json.toString(), '--output', output.toString(), '--repo', 'apache/grails-core', '--pr-number', 'null'] as String[], poster)
+        then:
+        code == 0
+        Files.readString(output).toLowerCase().contains('no comparison was possible')
+        0 * poster._
+    }
+
+    def "fail on regression remains successful"() {
+        given:
+        Path head = temporaryDirectory.resolve('head.json')
+        Path base = temporaryDirectory.resolve('base.json')
+        String json = '[{"benchmark":"sample.Run","mode":"avgt","primaryMetric":{"score":%s,"scoreError":1,"scoreUnit":"ns/op"}}]'
+        Files.writeString(head, String.format(json, '120'))
+        Files.writeString(base, String.format(json, '100'))
+        expect:
+        JmhCompare.run(['--head', head.toString(), '--base', base.toString(), '--fail-on-regression'] as String[], Mock(CommentPoster)) == 0
+    }
+
+    private static Benchmark benchmark(double score, String unit = 'ns/op', List<Double> confidence = [99D, 101D]) {
+        new Benchmark('sample.Group.run', score, 1D, confidence, unit, 'avgt', null)
+    }
+
+    private static Comparison compare(Benchmark head, Benchmark base) {
+        BenchmarkComparator.compare([(head.identity): head], [(base.identity): base], .1D)
+    }
+}
diff --git a/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/PostFileSpec.groovy b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/PostFileSpec.groovy
new file mode 100644
index 0000000000..8535c448a3
--- /dev/null
+++ b/grails-benchmarks/src/test/groovy/org/apache/grails/benchmarks/report/PostFileSpec.groovy
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.grails.benchmarks.report
+
+import spock.lang.Specification
+import spock.lang.TempDir
+
+import java.nio.file.Files
+import java.nio.file.Path
+
+class PostFileSpec extends Specification {
+    @TempDir
+    Path temporaryDirectory
+
+    def "post file sends its contents verbatim to the comment poster"() {
+        given:
+        Path report = write('report.md', 'already marked\n\n<!-- grails-jmh-benchmark -->')
+        CommentPoster poster = Mock()
+
+        when:
+        int result = JmhCompare.run(['--post-file', report.toString(), '--repo', 'apache/grails-core', '--pr-number', '42'] as String[], poster, [GITHUB_TOKEN: 'token'])
+
+        then:
+        result == 0
+        1 * poster.post('already marked\n\n<!-- grails-jmh-benchmark -->', 'apache/grails-core', '42', 'token')
+    }
+
+    def "comment body appends the marker when absent"() {
+        expect:
+        GitHubComments.commentBody('report') == 'report\n\n<!-- grails-jmh-benchmark -->'
+    }
+
+    def "comment body truncates with the exact suffix"() {
+        when:
+        String body = GitHubComments.commentBody('x' * 70000)
+
+        then:
+        body.length() == GitHubComments.MAX_BODY
+        body.endsWith(GitHubComments.TRUNCATION)
+    }
+
+    def "post file skips when the token is absent"() {
+        given:
+        CommentPoster poster = Mock()
+
+        when:
+        int result = JmhCompare.run(['--post-file', write('report.md', 'report').toString(), '--repo', 'apache/grails-core', '--pr-number', '42'] as String[], poster, [:])
+
+        then:
+        result == 0
+        0 * poster._
+    }
+
+    def "post file skips when the repository is absent"() {
+        given:
+        CommentPoster poster = Mock()
+
+        when:
+        int result = JmhCompare.run(['--post-file', write('report.md', 'report').toString(), '--pr-number', '42'] as String[], poster, [GITHUB_TOKEN: 'token'])
+
+        then:
+        result == 0
+        0 * poster._
+    }
+
+    def "post file skips when the pull request number is absent"() {
+        given:
+        CommentPoster poster = Mock()
+
+        when:
+        int result = JmhCompare.run(['--post-file', write('report.md', 'report').toString(), '--repo', 'apache/grails-core'] as String[], poster, [GITHUB_TOKEN: 'token'])
+
+        then:
+        result == 0
+        0 * poster._
+    }
+
+    def "post file rejects a simultaneous head file"() {
+        expect:
+        JmhCompare.run(['--post-file', write('report.md', 'report').toString(), '--head', 'head.json'] as String[], Mock(CommentPoster), [:]) == 2
+    }
+
+    def "latest matching comment id prefers the newest bot report"() {
+        given:
+        List comments = [
+                [id: 10, body: 'old <!-- grails-jmh-benchmark -->', user: [login: 'github-actions[bot]']],
+                [id: 11, body: 'human note without marker', user: [login: 'alice']],
+                [id: 12, body: 'new <!-- grails-jmh-benchmark -->', user: [login: 'github-actions[bot]']],
+        ]
+
+        expect:
+        GitHubComments.latestMatchingCommentId(comments) == 12L
+    }
+
+    private Path write(String name, String content) {
+        Path path = temporaryDirectory.resolve(name)
+        Files.writeString(path, content)
+        path
+    }
+}
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/broad-base.json b/grails-benchmarks/src/test/resources/jmh-golden/broad-base.json
new file mode 100644
index 0000000000..e19b117639
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/broad-base.json
@@ -0,0 +1 @@
+[{"benchmark": "org.apache.grails.benchmarks.urlmappings.UrlMappingsBenchmark.matchWarmCache", "primaryMetric": {"score": 4.07, "scoreUnit": "ns/op", "scoreConfidence": [4.0, 4.15], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 100, "scoreUnit": "B/op"}}}, {"benchmark": "org.apache.grails.benchmarks.databinding.SimpleDataBinderBenchmark.bindFlatMap", "primaryMetric": {"score": 17200.0, "scoreUnit": "ns/op", "scoreConfidence": [17000, 17400], "sc [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/broad-head.json b/grails-benchmarks/src/test/resources/jmh-golden/broad-head.json
new file mode 100644
index 0000000000..28e7a92951
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/broad-head.json
@@ -0,0 +1 @@
+[{"benchmark": "org.apache.grails.benchmarks.urlmappings.UrlMappingsBenchmark.matchWarmCache", "primaryMetric": {"score": 8.77, "scoreUnit": "ns/op", "scoreConfidence": [8.7, 8.9], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 100, "scoreUnit": "B/op"}}}, {"benchmark": "org.apache.grails.benchmarks.databinding.SimpleDataBinderBenchmark.bindFlatMap", "primaryMetric": {"score": 18300.0, "scoreUnit": "ns/op", "scoreConfidence": [18000, 18600], "sco [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/edges-base.json b/grails-benchmarks/src/test/resources/jmh-golden/edges-base.json
new file mode 100644
index 0000000000..7ca9a13c50
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/edges-base.json
@@ -0,0 +1 @@
+[{"benchmark": "e.NonFinite.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreError": "NaN"}, "mode": "avgt"}, {"benchmark": "e.Insufficient.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op"}, "mode": "avgt"}, {"benchmark": "e.Switched.run", "primaryMetric": {"score": 200, "scoreUnit": "ns/op", "scoreConfidence": [199, 201], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "e.ModeSwitch.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidenc [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/edges-head.json b/grails-benchmarks/src/test/resources/jmh-golden/edges-head.json
new file mode 100644
index 0000000000..bf3e3b88dc
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/edges-head.json
@@ -0,0 +1 @@
+[{"benchmark": "e.NonFinite.run", "primaryMetric": {"score": 120, "scoreUnit": "ns/op", "scoreError": "NaN"}, "mode": "avgt"}, {"benchmark": "e.Insufficient.run", "primaryMetric": {"score": 120, "scoreUnit": "ns/op"}, "mode": "avgt"}, {"benchmark": "e.Switched.run", "primaryMetric": {"score": 5000, "scoreUnit": "ops/s", "scoreConfidence": [4900, 5100], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "e.ModeSwitch.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfid [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-broad.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-broad.md
new file mode 100644
index 0000000000..8f043af07b
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-broad.md
@@ -0,0 +1,37 @@
+### JMH Benchmark Report
+
+**Regressions:** 1
+**Improvements:** 2
+**Runner health:** worst ruler deviation: 12.4% in anonymous shard (CpuRulerBenchmark.integerArithmetic)
+Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
+**Ruler movements:** anonymous shard: CpuRulerBenchmark.integerArithmetic: 1.12x, anonymous shard: MemoryRulerBenchmark.allocateAndCopyArray: 0.93x
+
+> **Warning:** The runner was unstable BETWEEN the two halves of the A/B run. Treat results as unreliable. Runner health is a stability check, not a calibration factor.
+
+Group geometric means are descriptive only, not verdicts.
+
+| Group | Descriptive geomean speedup | n |
+| --- | ---: | ---: |
+| databinding | 0.94x | 1 |
+| gsp | 1.00x | 1 |
+| throughput | 1.20x | 1 |
+| urlmappings | 0.69x | 2 |
+| views | 2.00x | 1 |
+
+<details>
+<summary>Per-benchmark results</summary>
+
+| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |
+| --- | ---: | ---: | ---: | --- | ---: |
+| urlmappings.UrlMappingsBenchmark.matchWarmCache | 4.07 ns/op | 8.77 ns/op | 0.46x | REGRESSED | ~0 B/op |
+| throughput.Ops.run | 100 ops/s | 120 ops/s | 1.20x | IMPROVED | — |
+| views.ViewTemplateRenderingBenchmark.renderJsonTemplate | 0.92 ns/op | 0.46 ns/op | 2.00x | IMPROVED | +17 B/op (+17.0%) **candidate** |
+| databinding.SimpleDataBinderBenchmark.bindFlatMap | 1.72e+04 ns/op | 1.83e+04 ns/op | 0.94x | no clear change | +17 B/op (+1.7%) |
+| gsp.GroovyPageParserBenchmark.parseSmallTemplate | 9.98e+03 ns/op | 9.94e+03 ns/op | 1.00x | no clear change | ~0 B/op |
+| ruler.CpuRulerBenchmark.integerArithmetic | 100 ns/op | 89 ns/op | 1.12x | ruler - excluded | — |
+| ruler.MemoryRulerBenchmark.allocateAndCopyArray | 100 ns/op | 108 ns/op | 0.93x | ruler - excluded | — |
+| urlmappings.UrlMappingsBenchmark.matchColdVariedKeys | 818 ns/op | 802 ns/op | 1.02x | no clear change | +10 B/op (+1.0%) |
+
+</details>
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-edges.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-edges.md
new file mode 100644
index 0000000000..26e5231712
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-edges.md
@@ -0,0 +1,35 @@
+### JMH Benchmark Report
+
+**Regressions:** 0
+**Improvements:** 1
+**Runner health:** not measured
+Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
+
+Group geometric means are descriptive only, not verdicts.
+
+| Group | Descriptive geomean speedup | n |
+| --- | ---: | ---: |
+| e | 0.89x | 3 |
+| feature | 1.25x | 1 |
+| sample | 1.00x | 3 |
+
+<details>
+<summary>Per-benchmark results</summary>
+
+| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |
+| --- | ---: | ---: | ---: | --- | ---: |
+| feature.Subject.runlabel=Ruler | 100 ns/op | 80 ns/op | 1.25x | IMPROVED | — |
+| e.Insufficient.run | 100 ns/op | 120 ns/op | 0.83x | insufficient data | — |
+| e.NonFinite.run | 100 ns/op | 120 ns/op | 0.83x | insufficient data | — |
+| e.Shared.run | 100 ns/op | 100 ns/op | 1.00x | no clear change | — |
+| sample.binjected.run | 100 ns/op | 100 ns/op | 1.00x | no clear change | — |
+| sample.Bang.runxy | 100 ns/op | 100 ns/op | 1.00x | no clear change | — |
+| sample.Evil.runlabel=xhttp://example.com | 100 ns/op | 100 ns/op | 1.00x | no clear change | — |
+
+</details>
+
+**Dropped unpaired shard samples (2):** e.BaseOnly.run, e.HeadOnly.run
+
+**Malformed comparisons skipped:** 3
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-headonly.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-headonly.md
new file mode 100644
index 0000000000..597a2c1f97
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-headonly.md
@@ -0,0 +1,20 @@
+### JMH Benchmark Report
+
+**Regressions:** 0 (no base)
+**Improvements:** 0 (no base)
+**Runner health:** not measured (no base)
+
+No comparison was possible because the base revision has no benchmark harness.
+
+| Benchmark | Head score | Error | Unit |
+| --- | ---: | ---: | --- |
+| databinding.SimpleDataBinderBenchmark.bindFlatMap | 1.83e+04 | 1 | ns/op |
+| gsp.GroovyPageParserBenchmark.parseSmallTemplate | 9.94e+03 | 1 | ns/op |
+| ruler.CpuRulerBenchmark.integerArithmetic | 89 | 1 | ns/op |
+| ruler.MemoryRulerBenchmark.allocateAndCopyArray | 108 | 1 | ns/op |
+| throughput.Ops.run | 120 | 1 | ops/s |
+| urlmappings.UrlMappingsBenchmark.matchColdVariedKeys | 802 | 1 | ns/op |
+| urlmappings.UrlMappingsBenchmark.matchWarmCache | 8.77 | 1 | ns/op |
+| views.ViewTemplateRenderingBenchmark.renderJsonTemplate | 0.46 | 1 | ns/op |
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-norulers.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-norulers.md
new file mode 100644
index 0000000000..fb9a2a8c21
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-norulers.md
@@ -0,0 +1,24 @@
+### JMH Benchmark Report
+
+**Regressions:** 1
+**Improvements:** 1
+**Runner health:** not measured
+Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
+
+Group geometric means are descriptive only, not verdicts.
+
+| Group | Descriptive geomean speedup | n |
+| --- | ---: | ---: |
+| group | 1.00x | 2 |
+
+<details>
+<summary>Per-benchmark results</summary>
+
+| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |
+| --- | ---: | ---: | ---: | --- | ---: |
+| g.group.First.run | 100 ns/op | 200 ns/op | 0.50x | REGRESSED | — |
+| g.group.Second.run | 100 ns/op | 50 ns/op | 2.00x | IMPROVED | — |
+
+</details>
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-numbers.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-numbers.md
new file mode 100644
index 0000000000..9bd84fd2d1
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-numbers.md
@@ -0,0 +1,32 @@
+### JMH Benchmark Report
+
+**Regressions:** 0
+**Improvements:** 0
+**Runner health:** not measured
+Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
+
+Group geometric means are descriptive only, not verdicts.
+
+| Group | Descriptive geomean speedup | n |
+| --- | ---: | ---: |
+| n | 1.00x | 10 |
+
+<details>
+<summary>Per-benchmark results</summary>
+
+| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |
+| --- | ---: | ---: | ---: | --- | ---: |
+| n.A.run | 0.46 ns/op | 0.46 ns/op | 1.00x | no clear change | — |
+| n.B.run | 100 ns/op | 100 ns/op | 1.00x | no clear change | — |
+| n.C.run | 802 ns/op | 802 ns/op | 1.00x | no clear change | — |
+| n.D.run | 1.83e+04 ns/op | 1.83e+04 ns/op | 1.00x | no clear change | — |
+| n.E.run | 1 ns/op | 1 ns/op | 1.00x | no clear change | — |
+| n.F.run | 0.000123 ns/op | 0.000123 ns/op | 1.00x | no clear change | — |
+| n.G.run | 1.23e+08 ns/op | 1.23e+08 ns/op | 1.00x | no clear change | — |
+| n.H.run | 1.5 ns/op | 1.5 ns/op | 1.00x | no clear change | — |
+| n.I.run | 1e+06 ns/op | 1e+06 ns/op | 1.00x | no clear change | — |
+| n.J.run | 0.1 ns/op | 0.1 ns/op | 1.00x | no clear change | — |
+
+</details>
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/expected-shards.md b/grails-benchmarks/src/test/resources/jmh-golden/expected-shards.md
new file mode 100644
index 0000000000..77fee72996
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/expected-shards.md
@@ -0,0 +1,31 @@
+### JMH Benchmark Report
+
+**Regressions:** 0
+**Improvements:** 0
+**Runner health:** worst ruler deviation: 12.0% in shard-b.json (CpuRuler.run)
+Ruler benchmarks are excluded from verdicts and group summaries; runner health is a stability check, not a calibration factor.
+
+> **Warning:** No usable base/head pair was produced by shard-c.json. This comparison rests on 2 shard pair(s) instead of the expected 3, so the alternating measurement order did not fully cancel and the result is weaker than a normal run.
+**Ruler movements:** shard-a.json: CpuRuler.run: 0.89x, shard-b.json: CpuRuler.run: 1.12x
+
+> **Warning:** The runner was unstable BETWEEN the two halves of the A/B run. Treat results as unreliable. Runner health is a stability check, not a calibration factor.
+
+Group geometric means are descriptive only, not verdicts.
+
+| Group | Descriptive geomean speedup | n |
+| --- | ---: | ---: |
+| s | 0.95x | 1 |
+
+<details>
+<summary>Per-benchmark results</summary>
+
+| Benchmark | Base score | Head score | Speedup | Verdict | Allocation delta (ADVISORY) |
+| --- | ---: | ---: | ---: | --- | ---: |
+| ruler.CpuRuler.run | 100 ns/op | 101 ns/op | 0.99x | ruler - excluded | — |
+| s.Paired.run | 100 ns/op | 105 ns/op | 0.95x | no clear change | +200 B/op (+200.0%) **candidate** |
+
+</details>
+
+**Dropped unpaired shard samples (1):** s.CrossShard.run
+
+<!-- grails-jmh-benchmark -->
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/norulers-base.json b/grails-benchmarks/src/test/resources/jmh-golden/norulers-base.json
new file mode 100644
index 0000000000..2752cc1a11
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/norulers-base.json
@@ -0,0 +1 @@
+[{"benchmark": "g.group.First.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "g.group.Second.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/norulers-head.json b/grails-benchmarks/src/test/resources/jmh-golden/norulers-head.json
new file mode 100644
index 0000000000..40a0a12151
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/norulers-head.json
@@ -0,0 +1 @@
+[{"benchmark": "g.group.First.run", "primaryMetric": {"score": 200, "scoreUnit": "ns/op", "scoreConfidence": [199, 201], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "g.group.Second.run", "primaryMetric": {"score": 50, "scoreUnit": "ns/op", "scoreConfidence": [49, 51], "scoreError": 1.0}, "mode": "avgt"}]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/numbers-base.json b/grails-benchmarks/src/test/resources/jmh-golden/numbers-base.json
new file mode 100644
index 0000000000..6d5c750716
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/numbers-base.json
@@ -0,0 +1 @@
+[{"benchmark": "n.A.run", "primaryMetric": {"score": 0.46, "scoreUnit": "ns/op", "scoreConfidence": [0.45, 0.47], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.B.run", "primaryMetric": {"score": 100.0, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.C.run", "primaryMetric": {"score": 802.0, "scoreUnit": "ns/op", "scoreConfidence": [800, 804], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.D.run", "primaryMetric": {" [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/numbers-head.json b/grails-benchmarks/src/test/resources/jmh-golden/numbers-head.json
new file mode 100644
index 0000000000..6d5c750716
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/numbers-head.json
@@ -0,0 +1 @@
+[{"benchmark": "n.A.run", "primaryMetric": {"score": 0.46, "scoreUnit": "ns/op", "scoreConfidence": [0.45, 0.47], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.B.run", "primaryMetric": {"score": 100.0, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.C.run", "primaryMetric": {"score": 802.0, "scoreUnit": "ns/op", "scoreConfidence": [800, 804], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "n.D.run", "primaryMetric": {" [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-a.json b/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-a.json
new file mode 100644
index 0000000000..c6b6a9c3a2
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-a.json
@@ -0,0 +1 @@
+[{"benchmark": "s.Paired.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 100, "scoreUnit": "B/op"}}}, {"benchmark": "org.apache.grails.benchmarks.ruler.CpuRuler.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-b.json b/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-b.json
new file mode 100644
index 0000000000..e8e5da086d
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/shards-base/shard-b.json
@@ -0,0 +1 @@
+[{"benchmark": "s.Paired.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 100, "scoreUnit": "B/op"}}}, {"benchmark": "s.CrossShard.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "org.apache.grails.benchmarks.ruler.CpuRuler.run", "primaryMetric": {"score": 100, "scoreU [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-a.json b/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-a.json
new file mode 100644
index 0000000000..5629af041b
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-a.json
@@ -0,0 +1 @@
+[{"benchmark": "s.Paired.run", "primaryMetric": {"score": 120, "scoreUnit": "ns/op", "scoreConfidence": [119, 121], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 200, "scoreUnit": "B/op"}}}, {"benchmark": "s.CrossShard.run", "primaryMetric": {"score": 100, "scoreUnit": "ns/op", "scoreConfidence": [99, 101], "scoreError": 1.0}, "mode": "avgt"}, {"benchmark": "org.apache.grails.benchmarks.ruler.CpuRuler.run", "primaryMetric": {"score": 112, "score [...]
\ No newline at end of file
diff --git a/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-b.json b/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-b.json
new file mode 100644
index 0000000000..24bf70b5e7
--- /dev/null
+++ b/grails-benchmarks/src/test/resources/jmh-golden/shards-head/shard-b.json
@@ -0,0 +1 @@
+[{"benchmark": "s.Paired.run", "primaryMetric": {"score": 90, "scoreUnit": "ns/op", "scoreConfidence": [89, 91], "scoreError": 1.0}, "mode": "avgt", "secondaryMetrics": {"gc.alloc.rate.norm": {"score": 400, "scoreUnit": "B/op"}}}, {"benchmark": "org.apache.grails.benchmarks.ruler.CpuRuler.run", "primaryMetric": {"score": 89.28, "scoreUnit": "ns/op", "scoreConfidence": [88, 90], "scoreError": 1.0}, "mode": "avgt"}]
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 538e3898ec..b786bde881 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -109,6 +109,7 @@ def buildGroovySupportsMicronaut = buildGroovyVersionLine?.contains("'5.") ?: fa
 def skipMicronautProjects = explicitlySkipMicronaut || ((!buildJdkSupportsMicronaut || !buildGroovySupportsMicronaut) && !explicitlyIncludeMicronaut)
 
 include(
+        'grails-benchmarks',
         'grails-bootstrap',
         'grails-cache',
         'grails-codecs-core',