Claude Prompt for Bug Fixing
Optimize API response times performance in PHP with profiling, benchmarking, and targeted improvements.
You are an expert performance engineer with deep expertise in performance engineering. Optimize the performance of API response times in a PHP application. **Focus area:** API response times **Language:** PHP **Performance goal:** eliminate timeout errors **Current pain point:** The API response times is too slow and needs optimization ## Performance Assessment Framework ### Step 1: Measure Current Performance - Key metrics to capture for API response times (latency, throughput, memory, CPU) - Profiling tools specific to PHP and how to use them - How to set up reproducible benchmarks - Baseline measurement methodology (percentiles: p50, p95, p99) ### Step 2: Identify Bottlenecks - Common performance bottlenecks in PHP API response times - How to read and interpret profiler output - Flame graph analysis for CPU-bound issues - Memory allocation analysis for memory-bound issues - I/O analysis for network or disk-bound issues ### Step 3: Optimize (Ordered by Impact) Provide 10 optimization techniques for API response times in PHP, ordered from highest to lowest impact: For each technique: 1. What it optimizes and expected improvement range 2. Implementation approach (describe the code changes needed) 3. Trade-offs (complexity, readability, maintainability) 4. When NOT to use this optimization 5. How to measure the improvement ### Step 4: Validate Improvements - A/B testing approach for performance changes - Load testing methodology and tool recommendations - Regression testing to ensure functionality is preserved - Production monitoring to verify improvements under real load ## PHP-Specific Performance Tips - Runtime-specific optimizations (JIT, GC tuning, memory model) - Library and framework-specific performance tricks - Build-time optimizations (tree shaking, minification, AOT compilation) - Caching strategies at every layer ## Performance Budget - Define performance budgets for API response times - Set up automated performance regression detection - Create a performance dashboard with key metrics - Establish a review process for performance-impacting changes - Use precise technical terminology appropriate for the audience - Include code examples, configurations, or specifications where relevant - Document assumptions, prerequisites, and dependencies - Provide error handling and edge case considerations Present as numbered steps. Each step should have: a clear action title, detailed instructions, expected outcome, and common pitfalls to avoid.
More prompts for Bug Fixing.
Diagnose and resolve dependency conflicts, version mismatches, and peer dependency issues in any package manager.
Analyze concurrent code for race conditions, deadlocks, and timing bugs with detection strategies and fixes.
Analyze code for memory leak patterns, identify allocation issues, and generate detection and fix strategies.
Guide a structured incident response with root cause analysis, mitigation steps, and post-mortem documentation.
Comprehensive code review guide focused on error handling for Go projects.
Comprehensive code review guide focused on async patterns for Java projects.