jamesfredley opened a new pull request, #2494: URL: https://github.com/apache/groovy/pull/2494
## Summary Backport JMH benchmarks for invokedynamic performance patterns and Grails-like workload simulations from master to the GROOVY_5_0_X branch, enabling performance comparison testing on Groovy 5. Companion to #2393 (which targets GROOVY_4_0_X). The benchmark sources are taken from the latest master content (15+ follow-up fixes after the original GROOVY-10307 commit, including the SwitchPoint invalidation regression suite and Copilot review feedback). ## Changes ### New JMH benchmarks (16 files) **Core Groovy performance** (`org.apache.groovy.perf`): - `ClosureBench` - closure creation, reuse, capture, delegation, nesting, currying, composition, trampoline, collection operations - `GStringBench` - GString interpolation, concatenation, lazy evaluation - `GroovyIdiomBench` - Groovy idioms (safe navigation, elvis, spread, with/tap, destructuring) - `LoopsBench` - for/while/each/times/upto loop patterns - `MetaclassBench` - dynamic method dispatch overhead with metaclass changes - `MethodInvocationBench` - method dispatch (instance, static, overloaded, polymorphic, interface, dynamic) - `OperatorBench` - operator overloading, comparisons, range operations - `PropertyAccessBench` - property get/set patterns (direct, dynamic, nested) - `RunnerRegistryBench` - GroovyRunnerRegistry iterator performance **Grails-like patterns** (`org.apache.groovy.perf.grails`): - `CallSiteInvalidationBench` - SwitchPoint invalidation overhead for cross-type and same-type metaclass changes - `CategoryBench` - category usage patterns (single, nested, simultaneous, shadowing) - `DynamicDispatchBench` - methodMissing, propertyMissing, invokeMethod, ExpandoMetaClass injection - `GrailsLikePatternsBench` - composite patterns (service chains, controller actions, domain validation, config DSL, markup builder, full request cycle) - `GrailsWorkloadBench` - collection closure chains, spread operator, nested closure delegation, GString interpolation, project metrics aggregation - `MetaclassChangeBench` - metaclass modification impact (expando additions, replacements, multi-class cascade, burst/steady-state, closure dispatch) - `MetaclassVariationBench` - per-instance ExpandoMetaClass overhead (GORM domain class enhancement pattern) ### Build changes - Updated `org.apache.groovy-performance.gradle` to support `indy` property for toggling invokedynamic mode in JMH compilation (`-Pindy=true|false`, defaults to true) - Added `jmh` task input tracking and `jmhJar` output configuration - Migrated the performance subproject from JUnit 4 to JUnit 5 (using `versions.junit5` / `versions.junit5Platform` since GROOVY_5_0_X does not yet define `junit6`) - Updated `DummyTest.groovy` to use `org.junit.jupiter.api.Test` ### CI workflows - `groovy-jmh.yml` - runs JMH benchmarks with invokedynamic enabled (matrix: bench, core, grails suites) - `groovy-jmh-classic.yml` - runs JMH benchmarks with classic (non-indy) bytecode ### Groovy 5 compatibility adaptation - `DynamicDispatchBench`: moved `DynamicFinder`, `DynamicProperties`, and `MethodInterceptor` from static inner classes to package-level classes because Groovy 5 does not support `methodMissing`/`propertyMissing` on static inner classes (same adaptation as #2393, since the compiler restriction applies to both Groovy 4 and Groovy 5; master allows this on Groovy 6). ## Verification - `./gradlew :performance:jmhClasses` (indy mode) - BUILD SUCCESSFUL - `./gradlew :performance:jmhClasses -Pindy=false` (classic mode) - BUILD SUCCESSFUL - `./gradlew :performance:jmh -PbenchInclude=GroovyIdiomBench.elvis` - 3 elvis benchmarks completed successfully producing valid JMH output - `./gradlew :performance:test` - BUILD SUCCESSFUL (verifies the JUnit 5 migration) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
