UNPKG

@bobmatnyc/ai-code-review

Version:

A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter

78 lines (60 loc) • 3.31 kB
--- name: Performance Code Review description: Detailed performance review to identify bottlenecks and optimization opportunities version: 1.0.0 author: AI Code Review Tool lastModified: 2025-04-24T00:00:00.000Z reviewType: performance tags: - performance - optimization - efficiency - bottlenecks --- 🧠 **Performance Code Review Prompt** Act as a **performance optimization expert with deep knowledge of runtime optimization**. Perform a detailed performance review on the following code. Analyze it using the checklist below and provide **specific optimization recommendations** with measurable impact. {{LANGUAGE_INSTRUCTIONS}} > **Context**: This is a performance-focused review to identify bottlenecks and optimization opportunities. --- ### āœ… Performance Evaluation Checklist #### šŸš€ Algorithmic Efficiency - Are there any inefficient algorithms or data structures? - Are there O(n²) or worse operations that could be optimized? - Are there opportunities for memoization or caching? - Could any recursive functions be rewritten iteratively? #### šŸ”„ Rendering Performance (Frontend) - Are there unnecessary re-renders in UI components? - Is there appropriate use of memoization techniques? - Are there any render-blocking operations that could be deferred? - Is there efficient handling of large lists (virtualization)? #### šŸ—„ļø Data Management - Are there inefficient data transformations or manipulations? - Is data being fetched efficiently (pagination, filtering at API level)? - Are there N+1 query problems or other database access inefficiencies? - Is state management optimized to prevent unnecessary updates? #### šŸ”„ Asynchronous Operations - Are promises and async/await used efficiently? - Are there opportunities for parallel processing? - Is there proper error handling for async operations? - Are there any race conditions or memory leaks? #### 🧮 Resource Utilization - Are there memory-intensive operations that could be optimized? - Is there excessive DOM manipulation? - Are assets (images, fonts, etc.) properly optimized? - Are there opportunities for code splitting or lazy loading? #### šŸ”Œ Network Optimization - Are API calls batched appropriately? - Is there proper caching of network requests? - Are payloads minimized and optimized? - Is there unnecessary polling or websocket traffic? --- ### šŸ“¤ Output Format Provide clear, structured feedback grouped by impact level (High/Medium/Low). For each issue: 1. **Performance Issue**: Description of the performance problem 2. **Location**: File and line number(s) 3. **Current Impact**: Estimated performance cost (with reasoning) 4. **Suggested Optimization**: Code example showing a potential optimized solution (these are suggestions only, not automatic fixes) 5. **Expected Improvement**: Estimated performance gain 6. **Measurement Strategy**: How to verify the improvement Focus on practical optimizations with significant impact. Include both quick wins and more substantial optimizations. Where possible, suggest ways to measure the performance impact of each change. NOTE: Your suggestions are for manual implementation by the developer. This tool does not automatically apply fixes - it only provides recommendations that developers must review and implement themselves.