Optimize add_dynamical_decoupling

Open
#8,348 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@ChethanaMallisetty21 is already working on this.

Since Oct 2, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
performance

Research direction

Start from the timings and snippet in benchmarks/dynamical_decoupling_perf.py (around the batch path at the cited lines) and locate cirq.add_dynamical_decoupling. Add a dedicated benchmark for that transform, then profile it on many non-parameterized circuits to find hotspots. Done when the new benchmark exists and the batch path is measurably faster without changing behavior of the existing sweep/batch tests.

Written by the indexing model from the issue text.

Description

area/performance skill/experienced triage/accepted

This transformation is used in the test_dynamical_decoupling_sweep and test_dynamical_decoupling_batch benchmarks. According to the timings at https://github.com/quantumlib/Cirq/issues/7797#issuecomment-5689606118 this transformation has negligible (1%) impact for the sweep benchmark, but takes about 80% of the batch benchmark at line 86 below:

https://github.com/quantumlib/Cirq/blob/9a3e166643d9c31cb510083a476b89258e7418cf/benchmarks/dynamical_decoupling_perf.py#L78-L89

TODO

  • add dedicated benchmark for cirq.add_dynamical_decoupling. Example benchmark:

    check/pytest \
        --numprocesses=0 \
        --randomly-dont-reorganize \
        --benchmark-enable \
        --benchmark-columns=mean,stddev,median,iqr,rounds \
        "benchmarks/dynamical_decoupling_perf.py::test_dynamical_decoupling_batch[5-10]"
    
  • profile and optimize performance hotspots, particularly when applied for many non-parameterized circuits

Dominant language
Python
Stars
5.1k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/Cirq

All issues in quantumlib/Cirq

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.