This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 6e0750690d fix jmh tests (add @CS variant for AryBench)
6e0750690d is described below
commit 6e0750690dcca7ba8f5e9cffacc9f78975cc14d8
Author: Paul King <[email protected]>
AuthorDate: Mon Feb 23 22:24:20 2026 +1000
fix jmh tests (add @CS variant for AryBench)
---
.../src/jmh/groovy/org/apache/groovy/bench/Ary.groovy | 16 ++++++++++++++++
.../src/jmh/groovy/org/apache/groovy/bench/AryBench.java | 5 +++++
2 files changed, 21 insertions(+)
diff --git
a/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/Ary.groovy
b/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/Ary.groovy
index 97c804fb16..89681388ed 100644
--- a/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/Ary.groovy
+++ b/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/Ary.groovy
@@ -18,6 +18,8 @@
*/
package org.apache.groovy.bench
+import groovy.transform.CompileStatic
+
class Ary {
static int ary(int n) {
@@ -33,4 +35,18 @@ class Ary {
return y[0] + y[n-1]
}
+ @CompileStatic
+ static int aryCS(int n) {
+ int[] x = new int[n]
+ int[] y = new int[n]
+
+ for (int i = 0; i < n; i++)
+ x[i] = i + 1
+ for (int k = 0; k < 1000; k++ )
+ for (int j = n-1; j >= 0; j--)
+ y[j] += x[j]
+
+ return y[0] + y[n-1]
+ }
+
}
diff --git
a/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/AryBench.java
b/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/AryBench.java
index 1b1beb8073..f08e6d8d3f 100644
---
a/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/AryBench.java
+++
b/subprojects/performance/src/jmh/groovy/org/apache/groovy/bench/AryBench.java
@@ -52,6 +52,11 @@ public class AryBench {
return Ary.ary(n);
}
+ @Benchmark
+ public int groovyCS() {
+ return Ary.aryCS(n);
+ }
+
private static class JavaAry {
static int ary(int n) {
int[] x = new int[n];