Analysis Workflow¶
Effective quantum resource analysis requires a systematic approach. This guide demonstrates a proven workflow for analyzing quantum algorithms using Resource Analyzer, helping you move from initial assessment to optimization decisions.
Understanding Your Starting Point¶
When you first open a quantum resource estimate in Resource Analyzer, you're presented with a complete view of your algorithm's resource consumption. While it might be tempting to immediately start looking for optimizations, taking a structured approach will yield better results.
Start by understanding the overall scale of your resource requirements. Look at the root node of your call graph, which shows the total resource consumption. These numbers provide your baseline - the reference point against which you'll measure improvements.
Initial Assessment¶
Begin your analysis at the highest level. Instead of immediately expanding the entire call graph, examine the first level of nodes to understand the major components of your algorithm. This high-level view often reveals the general distribution of resources across your program's main functions.
For example, if you see that one branch consumes 80% of your total resources while three other branches share the remaining 20%, you've already identified where to focus your attention. This initial assessment helps you avoid spending time analyzing paths that won't significantly impact overall performance.
Drilling Down¶
Once you've identified promising areas for investigation, systematically explore the high-resource branches of your call graph. As you expand nodes, pay attention to both the absolute resource counts and the percentage of total resources. A function might have high per-call resource usage but execute rarely, or it might have modest per-call usage but execute millions of times.
Consider this example from a recent analysis:
Node: QPE
Per Call: 10,231 toffs/call
Total: 1.27 x 10⁶ total (0%)
Node: BE
Per Call: 4.33 x 10¹¹ toffs/call
Total: 2.27 x 10¹⁷ total (100%)
While QPE has significant per-call usage, BE's massive number of executions makes it the clear priority for optimization.
Documentation and Sharing¶
As you analyze your algorithm, document your findings. Resource Analyzer's sharing features make it easy to capture and communicate specific views of your analysis. When you find an interesting pattern or potential optimization target, save the view and share it with your team. Include notes about:
- The specific resource patterns you've identified
- Why certain nodes warrant attention
- Potential optimization approaches
- Questions for algorithm designers
This documentation becomes invaluable when working with team members or revisiting the analysis later.
Making Optimization Decisions¶
Resource analysis should inform your optimization strategy. When you've identified high-resource components, consider: The algorithmic structure that led to the resource consumption pattern. Can the algorithm be restructured to reduce the number of calls to expensive functions?
The nature of the resource usage. Are you seeing high T-gate counts that might be reduced through circuit optimization, or is the resource usage fundamental to the algorithm?
The potential impact of optimizations. Focus on changes that will meaningfully reduce your total resource count rather than local optimizations with minimal global impact.
Iterative Analysis¶
Quantum resource analysis is typically an iterative process. After making optimizations, return to Resource Analyzer to validate their impact. Compare the new resource estimates with your documented baseline to ensure changes are having the intended effect.
Keep in mind that optimizations might shift resource usage patterns rather than simply reducing them. Use Resource Analyzer's multi-metric analysis capabilities to ensure you're not inadvertently increasing one type of resource usage while reducing another.