java-performance-smell-detection

Detects potential code-level performance smells in Java code with severity ratings.

Updated Apr 20, 2020
One-click install
npx skills add https://github.com/UnterrainerInformatik/java-rdb-utils --skill java-performance-smell-detection-unterrainerinformatik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: java-performance-smell-detection
Source: https://github.com/UnterrainerInformatik/java-rdb-utils/tree/main/.agents/skills/java-performance-smell-detection
Command: npx skills add https://github.com/UnterrainerInformatik/java-rdb-utils --skill java-performance-smell-detection-unterrainerinformatik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Java developers often struggle to distinguish real performance problems from outdated optimization advice, especially with modern JVMs (Java 21/25) that already optimize many patterns. This Skill reviews Java code for potential performance smells while emphasizing measurement before optimization. ## Core Features & Use Cases - Smell Detection with Severity Ratings: Flags issues like regex compilation in loops, string concatenation in loops, boxing in hot paths, and unbounded collections, rated as high, medium, or low severity. - Modern Java Awareness: Accounts for Java 9+ invokedynamic string concatenation, Java 21 virtual threads, structured concurrency, and Java 25 optimizations so advice stays current. - Use Case: When reviewing a hot code path, ask for a performance check and receive a prioritized list of potential smells, guidance on whether each is worth fixing, and modern alternatives such as virtual threads for I/O-bound work. ## Quick Start Review this Java method for potential performance issues and rate each finding by severity.

Frequently Asked Questions about java-performance-smell-detection

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

FAQPage Schema
How do I find performance issues in Java code?▼

Review code for common smells like regex compilation in loops, string concatenation in loops, boxing in hot paths, and unbounded collections. Always measure with JMH or a profiler before optimizing, since modern JVMs already handle many patterns well.

Is string concatenation with + still slow in Java?▼

Since Java 9, simple concatenation with + uses invokedynamic and is well optimized by the JVM. However, concatenation inside loops still creates a new String each iteration, so StringBuilder or String.join remains the right choice there.

When should I use parallel streams in Java?▼

Parallel streams help only for CPU-intensive work on large collections, typically over 10,000 items. Avoid them on small collections where overhead exceeds benefit, and never use them with shared mutable state due to race conditions.

Does this skill cover JPA or database performance?▼

No, database concerns like N+1 queries, lazy loading, and pagination are explicitly out of scope and handled by the java-jpa-patterns skill. This skill focuses only on code-level smells such as streams, collections, boxing, and regex.

When should I not optimize Java code?▼

Skip optimization when the code is not a hot path, when no measured problem exists, when readability would suffer, or when collections are small. Clear code usually matters more than micro-optimizations that save microseconds.