145-java-refactoring-high-performance

Solid

Use when you need to refactor Java code for high performance — including memory/allocation reduction, CPU hot-path optimization, and syntax/API/control-flow improvements. This should trigger for requests such as Review Java code for high performance; Optimize Java hot path; Reduce Java allocations; Improve Java latency/throughput. Part of cursor-rules-java project

Code & Development 393 stars 78 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 92/100

Stars 20%
86
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Java rules for High Performance Identify and apply practical Java high-performance techniques using a measure-first approach, with emphasis on allocation reduction, data layout, concurrency discipline, and evidence-based validation. **What is covered in this Skill?** - Measure-first workflow for Java code optimization - JVM/runtime-aware coding guidance - Allocation reduction techniques with bad/good patterns - CPU hot-path simplification and loop-level efficiency patterns - Concurrency/backpressure and timeout/cancellation discipline - I/O, parsing, and serialization efficiency patterns - Persistence/query and caching strategy guidance - Java-centric decision workflow: keep/revert based on measured impact **Scope:** Practical optimization in application code and APIs. Apply only where profiling indicates real bottlenecks. ## Constraints Performance optimization must be evidence-driven and safe, focused on Java code changes that preserve correctness and maintainability. - **MEASURE-FIRST**: Establish baseline behavior and identify Java code hot paths before optimization - **NO PREMATURE OPTIMIZATION**: Only optimize code paths identified by profiling evidence - **BEFORE APPLYING**: Read the relevant reference(s) for bad/good examples and measurement workflow - **EDGE CASE**: If hotspot evidence is unclear, ask clarifying questions before changing code ## When to use this skill - Review Java code for high performance - Optimize Java hot path - Reduce Java allocation...

Details

Author
jabrena
Repository
jabrena/cursor-rules-java
Created
1 years ago
Last Updated
today
Language
Java
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Solid

163-java-profiling-refactor

Use when you need to refactor Java code based on profiling analysis findings — including reviewing docs/profiling-problem-analysis and docs/profiling-solutions, identifying specific performance bottlenecks, and implementing targeted code changes to address CPU, memory, or threading issues. This should trigger for requests such as Refactor the code with profiling; Apply profiling; Refactor the code with profiling; Optimize hot path. Part of cursor-rules-java project

393 Updated today
jabrena
Code & Development Solid

141-java-refactoring-with-modern-features

Use when you need to refactor Java code to adopt modern Java features (Java 8+) — including migrating anonymous classes to lambdas, replacing Iterator loops with Stream API, adopting Optional for null safety, switching from legacy Date/Calendar to java.time, using collection factory methods, applying text blocks, var inference, or leveraging Java 25 features like flexible constructor bodies and module import declarations. This should trigger for requests such as Review Java code for modern Java development; Apply best practices for modern Java development in Java code. Part of cursor-rules-java project

393 Updated today
jabrena
AI & Automation Solid

164-java-profiling-verify

Use when you need to verify Java performance optimizations by comparing profiling results before and after refactoring — including baseline validation, post-refactoring report generation, quantitative before/after metrics comparison, side-by-side flamegraph analysis, regression detection, or creating profiling-comparison-analysis and profiling-final-results documentation. This should trigger for requests such as Verify performance fix; Verify the performance; Verify the memory; Verify the threading. Part of cursor-rules-java project

393 Updated today
jabrena
API & Backend Listed

performance-smell-detection

Detect potential code-level performance smells in Java - streams, collections, boxing, regex, object creation. Provides awareness, not absolutes - always measure before optimizing. For JPA/database performance, use jpa-patterns instead.

605 Updated 3 months ago
decebals
AI & Automation Solid

122-java-type-design

Use when you need to review, improve, or refactor Java code for type design quality — including establishing clear type hierarchies, applying consistent naming conventions, eliminating primitive obsession with domain-specific value objects, leveraging generic type parameters, creating type-safe wrappers, designing fluent interfaces, ensuring precision-appropriate numeric types (BigDecimal for financial calculations), and improving type contrast through interfaces and method signature alignment. This should trigger for requests such as Review Java code for type design; Improve type design in Java code; Fix primitive obsession in Java code; Create value objects in Java code. Part of cursor-rules-java project

393 Updated today
jabrena