This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new e680120e Fix benchmarks
e680120e is described below
commit e680120e74a56e51ecff52713cb5167cbcc47867
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Dec 5 07:33:40 2025 -0500
Fix benchmarks
---
pom.xml | 36 ++++++++++++++++++++--
.../jmh/LongestCommonSubsequencePerformance.java | 8 ++---
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index bcab4f57..f159e872 100644
--- a/pom.xml
+++ b/pom.xml
@@ -598,13 +598,45 @@
</build>
</profile>
<profile>
+ <!-- mvn clean test -P benchmark -->
<id>benchmark</id>
<properties>
<skipTests>true</skipTests>
<benchmark>org.apache</benchmark>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-core</artifactId>
+ <version>${commons.jmh.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-generator-annprocess</artifactId>
+ <version>${commons.jmh.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.5.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<build>
<plugins>
+ <!-- Enable the compilation of the benchmarks -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${commons.compiler.version}</version>
+ <configuration combine.self="override">
+ <testIncludes>
+ <testInclude>**/*</testInclude>
+ </testIncludes>
+ </configuration>
+ </plugin>
+ <!-- Hook the benchmarks to the test phase -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@@ -620,12 +652,12 @@
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
- <classpath/>
+ <classpath />
<argument>org.openjdk.jmh.Main</argument>
<argument>-rf</argument>
<argument>json</argument>
<argument>-rff</argument>
- <argument>target/jmh-result.${benchmark}.json</argument>
+ <argument>target/jmh-result.json</argument>
<argument>${benchmark}</argument>
</arguments>
</configuration>
diff --git
a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
index a810e116..eef5f9d3 100644
---
a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
+++
b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
@@ -134,7 +134,7 @@ public class LongestCommonSubsequencePerformance {
}
@Benchmark
- void testLCS(final InputData data) {
+ public void testLCS(final InputData data) {
final LongestCommonSubsequence lcs = new LongestCommonSubsequence();
for (final Pair<CharSequence, CharSequence> input : data.inputs) {
lcs.longestCommonSubsequence(input.getLeft(), input.getRight());
@@ -142,7 +142,7 @@ public class LongestCommonSubsequencePerformance {
}
@Benchmark
- void testLCSBaseline(final InputData data) {
+ public void testLCSBaseline(final InputData data) {
final BaselineLongestCommonSubsequence lcs = new
BaselineLongestCommonSubsequence();
for (final Pair<CharSequence, CharSequence> input : data.inputs) {
lcs.longestCommonSubsequence(input.getLeft(), input.getRight());
@@ -150,7 +150,7 @@ public class LongestCommonSubsequencePerformance {
}
@Benchmark
- void testLCSLen(final InputData data) {
+ public void testLCSLen(final InputData data) {
final LongestCommonSubsequence lcs = new LongestCommonSubsequence();
for (final Pair<CharSequence, CharSequence> input : data.inputs) {
lcs.apply(input.getLeft(), input.getRight());
@@ -158,7 +158,7 @@ public class LongestCommonSubsequencePerformance {
}
@Benchmark
- void testLCSLenBaseline(final InputData data) {
+ public void testLCSLenBaseline(final InputData data) {
final BaselineLongestCommonSubsequence lcs = new
BaselineLongestCommonSubsequence();
for (final Pair<CharSequence, CharSequence> input : data.inputs) {
lcs.apply(input.getLeft(), input.getRight());