-
Notifications
You must be signed in to change notification settings - Fork 11
Add JMH benchmarks to CI with performance regression detection #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: thebeanogamer <[email protected]>
Co-authored-by: thebeanogamer <[email protected]>
Co-authored-by: thebeanogamer <[email protected]>
thebeanogamer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically fail the CI check if performance has meaningfully regressed since the previous commit on the default branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates JMH benchmarks into the CI pipeline to automatically run performance benchmarks and publish results as artifacts. The implementation addresses the requirement to run existing Base58 encoding and crypto operation benchmarks as part of CI.
- Added three new Gradle tasks for building, running, and reporting JMH benchmarks with configurable parameters
- Integrated a new GitHub Actions job that runs benchmarks on every push/PR and uploads results as artifacts
- Updated documentation with comprehensive instructions for running benchmarks locally and accessing CI results
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| message-encoding/build.gradle | Added three Gradle tasks (jmhJar, jmh, jmhReport) for benchmark execution with configurable parameters |
| .github/workflows/gradle.yml | Added jmh-benchmarks job to run benchmarks in CI and upload results as artifacts |
| message-encoding/src/jmh-test/README.md | Enhanced documentation with detailed instructions for running benchmarks and accessing CI results |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // JMH command line options | ||
| args = [ | ||
| '-rf', 'json', // Result format: JSON | ||
| '-rff', "${project.buildDir}/reports/jmh/results.json", // Result file |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should be layout.buildDirectory.dir('reports/jmh/results.json').get().asFile.absolutePath.
|
|
||
| // Create reports directory | ||
| doFirst { | ||
| file("${project.buildDir}/reports/jmh").mkdirs() |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should be layout.buildDirectory.dir('reports/jmh').get().asFile.mkdirs().
|
|
||
| // Print results location after execution | ||
| doLast { | ||
| println "JMH benchmark results written to: ${project.buildDir}/reports/jmh/results.json" |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should reference layout.buildDirectory.dir('reports/jmh/results.json').get().asFile.absolutePath.
| // JMH command line options | ||
| args = [ | ||
| '-rf', 'text', // Result format: text | ||
| '-rff', "${project.buildDir}/reports/jmh/results.txt", // Result file |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should be layout.buildDirectory.dir('reports/jmh/results.txt').get().asFile.absolutePath.
| ] | ||
|
|
||
| doFirst { | ||
| file("${project.buildDir}/reports/jmh").mkdirs() |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should be layout.buildDirectory.dir('reports/jmh').get().asFile.mkdirs().
| } | ||
|
|
||
| doLast { | ||
| println "JMH benchmark results written to: ${project.buildDir}/reports/jmh/results.txt" |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use layout.buildDirectory instead of the deprecated project.buildDir property. This should reference layout.buildDirectory.dir('reports/jmh/results.txt').get().asFile.absolutePath.
| println "JMH benchmark results written to: ${project.buildDir}/reports/jmh/results.txt" | |
| println "JMH benchmark results written to: ${layout.buildDirectory.dir('reports/jmh/results.txt').get().asFile.absolutePath}" |
|
@copilot please action all the reviews |
Co-authored-by: thebeanogamer <[email protected]>
Added performance regression detection in commit |
|
CI is failing, can you tell me why? If an issue already exists, just update it rather than raising a new one. Put the Python scripts in the repo rather than inlining them in the YAML |
- Use FETCH_HEAD instead of origin/master for checkout - Check if JMH tasks exist on master before attempting baseline build - Handle first-time setup gracefully when master doesn't have JMH tasks - Save baseline results outside build directory to avoid conflicts - Add clearer status messages with emoji indicators Co-authored-by: thebeanogamer <[email protected]>
Fixed the CI workflow issues in commit Issues identified and resolved:
The workflow will now gracefully handle first-time setup and only run comparisons when master has the JMH infrastructure. |
Co-authored-by: thebeanogamer <[email protected]>
Summary
Successfully integrated JMH benchmarks into CI pipeline with regression detection:
jmh(JSON output),jmhReport(text output),jmhJar(build executable JAR)message-encoding/build/reports/jmh/directoryOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.