Skip to content

Conversation

Copy link

Copilot AI commented Oct 8, 2025

  • Explore repository structure and understand existing JMH benchmarks
  • Verify project builds successfully
  • Add JMH Gradle tasks to message-encoding/build.gradle
    • Added jmhJar task to create executable JAR with benchmarks
    • Added jmh task to run benchmarks and generate JSON results
    • Added jmhReport task to run benchmarks with text output
    • Made tasks configurable via project properties (jmh.fork, jmh.warmup, jmh.iterations)
    • Excluded signature files to prevent security exceptions
  • Add GitHub Actions workflow job to run JMH benchmarks
    • Added new jmh-benchmarks job to gradle.yml
    • Job runs both jmh and jmhReport tasks
    • Uploads JSON and text results as artifacts
    • Displays summary in workflow logs
  • Verify build and JMH tasks work correctly
    • Tested jmhJar task builds successfully
    • Tested jmh task generates JSON results
    • Tested jmhReport task generates text results
    • Verified all 8 benchmarks are available (Base58 encoding/decoding and Ed25519 point validation)
  • Update documentation to reflect CI integration
    • Added instructions for running benchmarks via Gradle
    • Documented configurable parameters
    • Added CI integration section
    • Listed result file locations
  • Add performance regression detection
    • Created Python script (.github/scripts/compare_benchmarks.py) to compare benchmark results
    • Script compares PR results against master branch baseline
    • Automatically fails CI if performance regresses by >10%
    • Only runs on pull requests, not on master branch commits
    • Handles missing baselines gracefully by building them on-demand
  • Fix CI workflow issues
    • Fixed git checkout to use FETCH_HEAD instead of origin/master
    • Added check for JMH tasks existence on master before baseline build
    • Handles first-time setup when master doesn't have benchmarks yet
    • Saves baseline results outside build directory to avoid conflicts
    • Removed Python cache files and updated .gitignore

Summary

Successfully integrated JMH benchmarks into CI pipeline with regression detection:

  • Gradle Tasks: jmh (JSON output), jmhReport (text output), jmhJar (build executable JAR)
  • CI Job: Runs automatically on every push/PR, uploads results as artifacts
  • Regression Detection: Compares PR benchmarks vs master, fails if >10% slower (when master has JMH tasks)
  • Benchmarks: 4 Base58 operations + 4 Ed25519 curve validation operations
  • Results: Saved to message-encoding/build/reports/jmh/ directory
  • First-time Setup: Gracefully handles case where master doesn't have JMH tasks yet
Original prompt

This section details on the original issue you should resolve

<issue_title>Add Base58 encoding JMH tests to CI and publish results</issue_title>
<issue_description>There are JMH tests for the comparison for some base58 and crypto operations. We should run them as part of CI and publish the results.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #25

💡 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.

Copilot AI changed the title [WIP] Add Base58 encoding JMH tests to CI Add JMH benchmarks to CI and publish results Oct 8, 2025
Copilot finished work on behalf of thebeanogamer October 8, 2025 12:32
Copilot AI requested a review from thebeanogamer October 8, 2025 12:32
Copy link
Member

@thebeanogamer thebeanogamer left a 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

@thebeanogamer thebeanogamer requested a review from Copilot October 8, 2025 12:42
Copy link

Copilot AI left a 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
Copy link

Copilot AI Oct 8, 2025

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.

Copilot uses AI. Check for mistakes.

// Create reports directory
doFirst {
file("${project.buildDir}/reports/jmh").mkdirs()
Copy link

Copilot AI Oct 8, 2025

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().

Copilot uses AI. Check for mistakes.

// Print results location after execution
doLast {
println "JMH benchmark results written to: ${project.buildDir}/reports/jmh/results.json"
Copy link

Copilot AI Oct 8, 2025

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.

Copilot uses AI. Check for mistakes.
// JMH command line options
args = [
'-rf', 'text', // Result format: text
'-rff', "${project.buildDir}/reports/jmh/results.txt", // Result file
Copy link

Copilot AI Oct 8, 2025

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.

Copilot uses AI. Check for mistakes.
]

doFirst {
file("${project.buildDir}/reports/jmh").mkdirs()
Copy link

Copilot AI Oct 8, 2025

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().

Copilot uses AI. Check for mistakes.
}

doLast {
println "JMH benchmark results written to: ${project.buildDir}/reports/jmh/results.txt"
Copy link

Copilot AI Oct 8, 2025

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.

Suggested change
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 uses AI. Check for mistakes.
@thebeanogamer
Copy link
Member

@copilot please action all the reviews

Copy link
Author

Copilot AI commented Oct 8, 2025

Automatically fail the CI check if performance has meaningfully regressed since the previous commit on the default branch

Added performance regression detection in commit {commit_hash}. The CI now automatically compares PR benchmark results against the master branch baseline and fails if any benchmark shows >10% performance regression. The comparison script is at .github/scripts/compare_benchmarks.py and only runs on pull requests.

Copilot AI changed the title Add JMH benchmarks to CI and publish results Add JMH benchmarks to CI with performance regression detection Oct 8, 2025
Copilot AI requested a review from thebeanogamer October 8, 2025 12:59
Copilot finished work on behalf of thebeanogamer October 8, 2025 12:59
@thebeanogamer
Copy link
Member

@copilot

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]>
Copy link
Author

Copilot AI commented Oct 8, 2025

@copilot

CI is failing, can you tell me why?
...

Fixed the CI workflow issues in commit c8f90c9:

Issues identified and resolved:

  1. ✅ Git checkout was trying to use origin/master which doesn't work - now uses FETCH_HEAD
  2. ✅ Master branch doesn't have JMH tasks yet (they're being added in this PR) - added check to skip baseline if tasks don't exist
  3. ✅ Build directory conflicts when switching branches - now saves baseline results outside build dir
  4. ✅ Python script is already in the repo at .github/scripts/compare_benchmarks.py (not inlined)

The workflow will now gracefully handle first-time setup and only run comparisons when master has the JMH infrastructure.

Copilot finished work on behalf of thebeanogamer October 8, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Base58 encoding JMH tests to CI and publish results

3 participants