Skip to content

Commit 3679046

Browse files
dfa1claude
andcommitted
ci(performance): add daily JMH benchmark workflow
Switch exec-maven-plugin from exec:java to exec:exec to pass explicit JVM flags. Always write JMH results to target/benchmark-result.json. Add github-action-benchmark workflow (20:00 UTC = 22:00 CEST) that stores history on gh-pages and alerts on >30% regression. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6ecf845 commit 3679046

3 files changed

Lines changed: 83 additions & 5 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Benchmarks
2+
3+
on:
4+
schedule:
5+
- cron: '0 20 * * *' # 22:00 CEST / 21:00 CET
6+
workflow_dispatch:
7+
8+
jobs:
9+
benchmark:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Azul Zulu JDK 25
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: zulu
21+
java-version: '25'
22+
23+
- name: Cache Maven repository
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
31+
- name: Install protobuf compiler
32+
run: sudo apt-get install -y protobuf-compiler
33+
34+
- name: Install flatc 25.12.19
35+
run: |
36+
curl -fsSL -o flatc.zip https://github.com/google/flatbuffers/releases/download/v25.12.19/Linux.flatc.binary.g++-13.zip
37+
unzip -j flatc.zip flatc
38+
sudo install -m 755 flatc /usr/local/bin/flatc
39+
40+
- name: Build
41+
run: ./mvnw compile -pl performance -am -DskipTests -q
42+
43+
- name: Run benchmarks
44+
run: ./mvnw exec:exec -pl performance -DskipTests
45+
46+
- name: Store benchmark results
47+
uses: benchmark-action/github-action-benchmark@v1
48+
with:
49+
tool: jmh
50+
output-file-path: performance/target/benchmark-result.json
51+
github-token: ${{ secrets.GITHUB_TOKEN }}
52+
auto-push: true
53+
alert-threshold: '130%'
54+
comment-on-alert: true
55+
fail-on-alert: false
56+
gh-pages-branch: gh-pages
57+
benchmark-data-dir-path: dev/bench

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ Never use `mvn install` or `./mvwn install`.
4747
./mvnw verify -pl integration -am -Dit.test="RustWritesJavaReadsIntegrationTest#s3_pcoVortex_javaDecodeMatchesJni"
4848

4949
# Run all benchmarks
50-
./mvnw compile exec:java -pl performance -am -DskipTests
50+
./mvnw compile -pl performance -am -DskipTests -q && ./mvnw exec:exec -pl performance -DskipTests
5151

5252
# Run specific benchmark class
53-
./mvnw compile exec:java -pl performance -am -DskipTests -Dexec.args="RustVsJavaReadBenchmark"
53+
./mvnw compile -pl performance -am -DskipTests -q && ./mvnw exec:exec -pl performance -DskipTests -Dbenchmark=RustVsJavaReadBenchmark
5454

5555
# Run specific benchmark method (always use ClassName.methodName filter)
56-
./mvnw compile exec:java -pl performance -am -DskipTests -Dexec.args="RustVsJavaReadBenchmark.javaReadVolume"
56+
./mvnw compile -pl performance -am -DskipTests -q && ./mvnw exec:exec -pl performance -DskipTests -Dbenchmark=RustVsJavaReadBenchmark.javaReadVolume
5757
```
5858

5959
### File format

performance/pom.xml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
<artifactId>performance</artifactId>
1313

14+
<properties>
15+
<!-- Override with -Dbenchmark="ClassName.methodName" to run a specific benchmark -->
16+
<benchmark>.*</benchmark>
17+
<!-- JMH output: override with -Djmh.outputFile=/dev/null to suppress -->
18+
<jmh.outputFile>${project.build.directory}/benchmark-result.json</jmh.outputFile>
19+
</properties>
20+
1421
<dependencies>
1522
<dependency>
1623
<groupId>io.github.dfa1.vortex</groupId>
@@ -74,12 +81,26 @@
7481
</annotationProcessorPaths>
7582
</configuration>
7683
</plugin>
77-
<!-- Run benchmarks: ./mvnw compile exec:java -pl performance -am -DskipTests -Dexec.args="ClassName.method" -->
84+
<!-- Run benchmarks: ./mvnw compile -pl performance -am -DskipTests -q && ./mvnw exec:exec -pl performance -DskipTests [-Dexec.args="ClassName.methodName"] -->
7885
<plugin>
7986
<groupId>org.codehaus.mojo</groupId>
8087
<artifactId>exec-maven-plugin</artifactId>
8188
<configuration>
82-
<mainClass>org.openjdk.jmh.Main</mainClass>
89+
<executable>java</executable>
90+
<arguments>
91+
<argument>--add-opens</argument>
92+
<argument>java.base/java.nio=ALL-UNNAMED</argument>
93+
<argument>--enable-native-access=ALL-UNNAMED</argument>
94+
<argument>--sun-misc-unsafe-memory-access=allow</argument>
95+
<argument>-classpath</argument>
96+
<classpath/>
97+
<argument>org.openjdk.jmh.Main</argument>
98+
<argument>${benchmark}</argument>
99+
<argument>-rf</argument>
100+
<argument>json</argument>
101+
<argument>-rff</argument>
102+
<argument>${jmh.outputFile}</argument>
103+
</arguments>
83104
</configuration>
84105
</plugin>
85106
</plugins>

0 commit comments

Comments
 (0)