add-benchmarks

Add JMH benchmarking to Spring Boot 4 projects with Gradle plugin setup.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-benchmarks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-benchmarks
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/add-benchmarks
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-benchmarks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of adding repeatable, in-JVM performance benchmarks to a Spring Boot 4 codebase so you can measure throughput and detect performance regressions.

Core Features & Use Cases

  • JMH setup for Spring Boot 4: Adds the me.champeau.jmh Gradle plugin and JMH dependencies, plus a safe, on-demand ./gradlew jmh workflow.
  • Correct build configuration: Configures the jmhJar task with zip64 for large Spring Boot classpaths and defines a benchmark configuration block with short CI-friendly iterations.
  • Seed benchmark generation: Creates a baseline *Benchmark.java under src/jmh/java/<package>/ to establish a reference point before you add real domain benchmarks.
  • Use case: When introducing a new hot path (e.g., serialization-heavy logic, mapping changes, or database query adjustments), use this Skill to benchmark throughput of targeted service-method implementations.

Quick Start

Tell the Skill: add JMH benchmarks to my Spring Boot 4 project so I can run ./gradlew jmh and start measuring throughput with a seed benchmark.

Frequently Asked Questions about add-benchmarks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add JMH microbenchmarks to a Spring Boot 4 project using Gradle?

To add JMH microbenchmarks to a Spring Boot 4 project, apply the me.champeau.jmh Gradle plugin and dependencies, configure the jmhJar task with zip64 handling, and seed a baseline benchmark class under src/jmh/java to measure throughput on demand.

When should I use JMH microbenchmarks instead of HTTP or cross-service load testing?

Use JMH microbenchmarks when you need to measure in-JVM behavior such as method-level performance or harness overhead, rather than HTTP or cross-service load testing. This targets throughput of specific service-method implementations within the JVM.

Does the Gradle JMH plugin work with large Spring Boot 4 classpaths?

Yes, the Gradle JMH plugin works with large Spring Boot 4 classpaths by configuring the jmhJar task with zip64 handling. This ensures the benchmark JAR builds correctly despite the large number of dependencies.

How do I keep JMH benchmarks from running during standard Gradle check tasks?

To keep JMH benchmarks out of standard Gradle check tasks, the configuration explicitly excludes JMH from tasks.check. This ensures benchmarks run only on-demand via ./gradlew jmh, keeping CI fast.

What is a seed benchmark class in JMH and why do I need one?

A seed benchmark class is a baseline *Benchmark.java file generated under src/jmh/java. It establishes a reference point for measuring throughput before you add real domain benchmarks for hot paths like serialization or database queries.