Skip to content

Split JMH benchmarks into separate CI job - #3214

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:split-jmh-benchmarks
Apr 29, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:split-jmh-benchmarks

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

Move JMH performance benchmarks out of the test matrix into a standalone parallel job in all four workflows (linux, macos, windows, pr).

Before: JDK 25 test jobs ran unit tests + comparison tests + JMH benchmarks sequentially, making them the slowest jobs in the matrix.

After: JDK 25 test jobs run unit tests + comparison tests only (with coverage upload). JMH benchmarks run in a separate parallel job with no coverage overhead.

Coverage uploads are unaffected — JMH benchmarks never contributed to coverage (they're in src/main, not src/test).

Benchmark jobs run on one runner per platform:

  • Linux: ubuntu-latest
  • macOS: macos-15
  • Windows: windows-2022
  • PR: ubuntu-latest

Summary by CodeRabbit

  • Chores
    • Moved JMH performance benchmarks into dedicated benchmark jobs (Linux, macOS, Windows, and PR workflows), decoupling them from test jobs and test matrices; benchmarks now run independently with a consistent JDK 25 setup and unified execution settings.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Moves JMH benchmark build-and-run out of conditional steps inside test matrix jobs and into dedicated top-level benchmarks jobs across four GitHub Actions workflows; each new job installs JDK 25, builds the oshi-benchmark jar (shaded, tests skipped) and runs the JMH jar with -wi 1 -i 3 -f 1. (47 words)

Changes

Cohort / File(s) Summary
CI Workflow Benchmark Job Extraction
/.github/workflows/linux.yaml, /.github/workflows/macos.yaml, /.github/workflows/pr.yaml, /.github/workflows/windows.yaml
Removed conditional JMH steps from test/testmatrix jobs and added new top-level benchmarks jobs. Each new job: checks out code, sets up JDK 25, runs Maven to package oshi-benchmark (shaded, tests skipped), then executes the generated JMH benchmarks.jar with -wi 1 -i 3 -f 1. Focus areas: job matrices/OS targets, JDK 25 setup, Maven packaging flags, and JMH invocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

⚙️ Pipelines hum a polished tune,
Jobs split out beneath JDK 25’s moon,
Benchmarks boxed, then set to run,
Results arrive like morning sun,
CI sings — performance in bloom! 🎶

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: splitting JMH benchmarks from test jobs into a separate CI job across workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 56 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Move JMH performance benchmarks out of the test matrix into a
standalone job in all four workflows (linux, macos, windows, pr).
This avoids slowing down the test+coverage jobs while still running
benchmarks in parallel. Coverage uploads are unaffected since JMH
benchmarks don't contribute to coverage.
@dbwiddis
dbwiddis force-pushed the split-jmh-benchmarks branch from 88a470d to 6cad2fa Compare April 29, 2026 01:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/pr.yaml (1)

88-90: Minor: Distribution differs from Windows CI workflow.

This job uses distribution: 'zulu' for all platforms including windows-latest, but the Windows CI workflow (.github/workflows/windows.yaml) uses distribution: 'temurin' for JDK 25. If the matrix stays multi-platform, consider matching distributions per OS to catch the same JDK-specific behaviors in PRs that would appear in master CI:

include:
  - os: windows-latest
    distribution: temurin
  - os: ubuntu-latest
    distribution: zulu
  - os: macos-latest
    distribution: zulu

Alternatively, if benchmarks run on ubuntu-latest only (per the PR description), this becomes a non-issue.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr.yaml around lines 88 - 90, The workflow currently sets
distribution: 'zulu' for all matrix entries (see java-version and distribution
keys); update the matrix so Windows uses distribution: 'temurin' while
Linux/macOS keep 'zulu' (or explicitly reduce the matrix to ubuntu-latest only
if benchmarks run solely on Ubuntu) so the PR CI matches the Windows CI behavior
in windows.yaml; adjust the matrix include entries accordingly for the
java-version/distribution pairs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/pr.yaml:
- Around line 88-90: The workflow currently sets distribution: 'zulu' for all
matrix entries (see java-version and distribution keys); update the matrix so
Windows uses distribution: 'temurin' while Linux/macOS keep 'zulu' (or
explicitly reduce the matrix to ubuntu-latest only if benchmarks run solely on
Ubuntu) so the PR CI matches the Windows CI behavior in windows.yaml; adjust the
matrix include entries accordingly for the java-version/distribution pairs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1ac2eb29-dcc0-4a13-b359-ec4ff2bcb4d1

📥 Commits

Reviewing files that changed from the base of the PR and between 88a470d and 6cad2fa.

📒 Files selected for processing (4)
  • .github/workflows/linux.yaml
  • .github/workflows/macos.yaml
  • .github/workflows/pr.yaml
  • .github/workflows/windows.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/linux.yaml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
.github/workflows/macos.yaml (1)

55-70: LGTM! Clean extraction of the benchmarks job.

The new benchmarks job is consistent with the linux.yaml approach — same JDK setup, Maven build command, and JMH parameters. Using macos-15 as the runner aligns with the coverage upload target in the testmatrix job above, which makes sense for keeping benchmark results comparable.

.github/workflows/pr.yaml (1)

76-81: Clarify: PR description says ubuntu-latest only, but code uses a 3-OS matrix.

The PR description states "Benchmark jobs run on one runner per platform: ... PR: ubuntu-latest", but this job runs benchmarks on all three OSes via the matrix. If the intent is to keep PR benchmark runs lightweight (single runner), consider:

 benchmarks:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [ubuntu-latest, macos-latest, windows-latest]
-      fail-fast: false
-    name: JMH Benchmarks, ${{ matrix.os }}
+    runs-on: ubuntu-latest
+    name: JMH Benchmarks

If running on all three is intentional for better PR coverage, updating the PR description would help avoid confusion.

.github/workflows/windows.yaml (1)

51-66: LGTM! Well-structured Windows benchmark job.

Good attention to detail with:

  • Quoted Maven flags ("-DskipTests") for PowerShell compatibility
  • Using temurin distribution to match the existing testmatrix configuration
  • Running on windows-2022 consistent with the coverage upload target

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.

1 participant