Overview

9 Evaluate performance of quantum algorithms

This chapter explains how to evaluate the performance of quantum algorithms rigorously and fairly, with the goal of identifying where practical quantum advantage might exist. It frames “quality” as a balance of accuracy, time to solution, and monetary cost, and stresses that comparisons must be made against the best available classical baselines that exploit problem structure. Using the N queens puzzle as the running example, it shows why asymptotic complexity alone is insufficient: practical performance depends on constants, crossover points, and implementation details such as oracle construction and encoding choices.

The text cautions against using simulator runtimes as a proxy for hardware performance, since simulators differ and are themselves classical programs. It instead grounds estimation in the assumptions of future fault-tolerant machines, outlining key architectural factors that shape runtime and qubit needs: slower physical operations than classical logic, noise necessitating error correction, limited connectivity that introduces routing overhead and auxiliary qubits, restricted native gate sets requiring decompositions, and costly magic state distillation for non-native gates. These realities create significant overheads and reveal meaningful trade-offs between runtime and the number of physical qubits.

To quantify these effects, the chapter introduces the Azure Quantum Resource Estimator, which takes a program, an error budget, and a hardware model to produce logical and physical resource counts, runtime estimates, and space-time trade-offs. Applying it to Grover-based N queens solvers (N=10, about 109 iterations), the encoding that maps each queen to a column index outperforms the per-cell bit encoding, with indicative estimates around 3 minutes using roughly 340k physical qubits versus about 37 minutes and 670k qubits. Despite this, classical approaches still dominate: even a simple brute-force Python solution finds all 10-queen placements in under 0.1 second, more advanced local search scales to enormous N rapidly, and constructive methods can generate solutions immediately. The chapter concludes that credible quantum performance evaluation demands careful baselines, realistic hardware assumptions, and full accounting of implementation overheads—especially for search problems where Grover-style speedups often fail to translate into practical advantage.

The key metrics that describe the quality of a problem solution are the accuracy of the result and the time and cost required to get it. We can often trade off these metrics by using different algorithms or implementations.
figure
To understand performance of a quantum algorithm, you need to take into account not only its asymptotic complexity, but its practical behavior. The performance estimates are affected by the overheads introduced by the algorithm implementation and then by its execution on a fault-tolerant quantum computer. You also need to choose the best known classical algorithm as the baseline for comparison.
figure
The classical solutions to the N queens puzzle range from brute-force solutions similar to those we considered as the equivalent to Grover’s search, to methods that exploit all the available information about the problem to construct the solution mathematically.
figure
When comparing the performance of algorithms, it’s important to consider not only their asymptotic behavior but also the details. Algorithms can have the same asymptotic behavior but vastly different growth rates once you take into account all the factors. The solution with worse asymptotic behavior can be better in practice if the problem sizes are smaller than the crossover point — the problem size for which two algorithms have similar performance.
figure
Physical qubits are noisy, they support a limited set of gates, and these gates are slow. We have to use error correction to enable reliable computation on noisy qubits. We also have to use a special process to implement arbitrary logical gates on logical qubits. These factors affect both the runtime of algorithms on the quantum computers and the numbers of qubits required to run them.
figure
An example of resource estimates produced by Azure Quantum Resource Estimator.
figure
The high-level inputs and processing logic of Azure Quantum Resource Estimator. The first step reduces the quantum program to a set of logical resource estimates. Then, AQRE looks for the parameters of the different architectural components of the quantum computer that allow to execute the program within the given error budget.
figure

Summary

  • The quality of a problem solution is a combination of the accuracy of the answer it gives and the time and the expense needed to produce that answer. When comparing quantum and classical solutions, it is important to use these practical metrics rather than more abstract properties such as the asymptotic behavior of the algorithms.
  • When we look for practical quantum advantage for a classical problem, we have to compare the quantum solution with the best known classical solution of all. Such a solution will typically be designed specifically for this problem and take advantage of all information about the problem structure.
  • If a problem has an efficient classical solution, quantum computing is unlikely to offer an improvement over it. The search for practical quantum advantage focuses on problems that don’t have a known efficient classical solution.
  • Quantum algorithms aim to run on future fault-tolerant quantum computers, so any estimates of the algorithms’ performance have to take into account the overhead introduced by the architecture of these computers.
  • Error correction is a technique that enables reliable computation using noisy qubits. It encodes logical qubits and gates — the ones used in quantum programs — as multiple physical qubits and gates on an actual quantum device.
  • Magic gates are gates that are not supported by the quantum computer directly but have to be generated using a separate process. These gates allow us to approximate any gate the program needs with required accuracy.
  • Error correction and magic state distillation are several of the key factors that impact the resource requirements of quantum algorithms. The other factors include execution time of quantum gates and measurements and the limitations on the qubit connectivity.
  • You have to take into account a lot of information about the logical architecture of quantum computers to make realistic estimates of your algorithm’s performance. Specialized software tools such as Azure Quantum Resource Estimator allow you to make these estimates automatically based on your quantum program.

FAQ

What does “quality” of a quantum solution mean in this chapter?The chapter defines solution quality by three metrics you can trade off: accuracy of the result, time to solution, and monetary cost. In practice, you often pick which metric to optimize (for example, minimize runtime) while constraining the others (acceptable accuracy and cost).
How should I choose the classical baseline when comparing to a quantum algorithm?Use the best known classical algorithm that exploits the problem’s structure, not a generic brute-force method. For N queens, that means considering backtracking, local search, and known constructive formulas—not just naive enumeration—because practical quantum advantage must beat the strongest classical approaches.
Why isn’t asymptotic complexity enough to judge performance?Asymptotics hide constants and implementation overheads that determine the crossover point where one algorithm actually becomes faster than another. An algorithm with better asymptotics can be slower on practically relevant sizes due to larger constants or overhead (as with Karatsuba multiplication vs schoolbook for moderate sizes).
Why do oracle costs matter so much in quantum algorithms?Quantum oracles must be reversible and compiled into elementary quantum gates, introducing substantial overhead compared to their classical counterparts. Simple classical operations (like arithmetic) can require many quantum gates, changing practical runtimes despite similar “number of oracle calls.”
Will Grover’s algorithm speed up database search?Unlikely. Databases use indexing and structure-aware query plans to avoid unstructured search, and many queries seek all matches, not just one. Grover’s quadratic speedup applies to unstructured search for a single marked item, which doesn’t reflect how real databases operate.
Why is simulator runtime a poor proxy for hardware performance?Simulators are classical programs that evolve an exponentially large state vector, so their runtime depends on simulation strategy (e.g., full-state vs sparse), not on physical gate timing. For example, the Qiskit full-state simulator’s performance is dominated by qubit count, whereas the Q# sparse simulator depends on the number of populated basis states—leading to very different timings for the same algorithm.
Which fault-tolerant hardware factors most affect performance?Key factors include slow physical gate/measurement times, noise necessitating error correction (inflating gate depth and qubit count), limited logical qubit connectivity (needing routing and auxiliary qubits), and the need to synthesize unsupported gates—each adding latency and qubit overhead.
What are magic gates and magic state distillation, and why do they matter?Many logical architectures support only a limited native gate set. Non-native “magic” gates (e.g., the T gate) are enabled by preparing special magic states and refining them via magic state distillation. Supplying enough high-fidelity magic states can dominate both runtime and qubit resources and often runs in parallel with the main computation.
What does Azure Quantum Resource Estimator (AQRE) do and what does it need?AQRE estimates qubits and runtime for running your Q# or Qiskit program on a fault-tolerant architecture. Inputs include the program, an error budget (maximum failure probability), and architectural assumptions (physical error rates/times, error-correction code, distillation protocol). It: 1) extracts logical resource counts, 2) maps them to the target logical architecture (connectivity and gate synthesis), and 3) sizes error correction and distillation to meet the error budget. It reports a space–time trade-off curve (qubits vs runtime) and a fastest point summary.
How did the N=10 queens case study compare quantum and classical performance?For ~109 Grover iterations: the “cell-per-bit” encoding estimated ~37 minutes with ~670k physical qubits, while the “column-index” encoding estimated ~3 minutes with ~340k qubits—so better encoding helped both time and qubit count. However, even a simple classical brute force in Python solved N=10 in under 0.1 s (and finds all solutions), and advanced classical methods solve much larger N efficiently, so these quantum approaches do not beat classical baselines.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Quantum Programming in Depth ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Quantum Programming in Depth ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Quantum Programming in Depth ebook for free