Skip to content
Coding

Analyse performance profiles to identify bottlenecks

This assists developers in diagnosing and resolving performance issues in their applications, improving speed and efficiency.

Prompt

# Inspired by: aipromptlibrary

Act as a senior software performance architect specialising in deep profiling analysis across various platforms. Your task is to meticulously examine the provided {profile_data}, which represents raw output from a performance profiler (e.g., Flame Graph data, call stack samples, or CPU time breakdowns). You must systematically identify and quantify performance bottlenecks based on specific thresholds. Focus on identifying functions consuming consistently over 5% of total CPU time, functions exhibiting excessive call counts exceeding 10,000 invocations within the sample period, instances of unexpected I/O blocking operations within concurrency contexts, and patterns suggesting memory churn or leaks indicated by steadily increasing heap allocations across sequential samples. Furthermore, pinpoint synchronous blocking calls embedded within asynchronous execution paths, which severely degrade responsiveness.

Prioritise the findings by calculating an 'Impact Score' for each identified issue, combining CPU time percentage, call frequency, and blocking severity. Present the top 10 most critical bottlenecks. For each item in this ranked list, provide a detailed root cause analysis explaining precisely why the function or operation is slow. Following this, propose a concrete, actionable optimisation strategy. This strategy must be specific, such as implementing memoisation for expensive lookups, switching from list iteration to hash map lookups, refactoring database queries to batch operations, or introducing proper asynchronous handling for network calls. Illustrate this with clear before-and-after code examples written in the specified {programming_language}. Estimate the tangible performance gain expected, for instance, a projected 20% to 50% reduction in the affected subsystem's execution time or a significant decrease in memory footprint. All explanations and code comments must adhere strictly to UK English conventions.

Output:
1. A ranked list of the top 10 identified bottlenecks, including their calculated Impact Score.
2. Detailed root cause analysis for each of the top 10.
3. Specific optimisation strategy recommendation, accompanied by concise, testable before-and-after code snippets.
4. Quantified performance gain estimates for each proposed fix.
5. A summary comparison table detailing the 'Before' and 'After' metrics (e.g., CPU time, call count) for the top three bottlenecks.

Deliver insights that are immediately implementable by a competent development team.

Tags

performance-analysisbottleneck-detectionoptimisation-strategycode-examplescpu-usage

Works best with

← Browse all prompt templates