Speed up cirq.map_operations and cirq.map_operations_and_unroll#6250
Merged
tanujkhattar merged 8 commits intoquantumlib:masterfrom Aug 24, 2023
Merged
Speed up cirq.map_operations and cirq.map_operations_and_unroll#6250tanujkhattar merged 8 commits intoquantumlib:masterfrom
cirq.map_operations and cirq.map_operations_and_unroll#6250tanujkhattar merged 8 commits intoquantumlib:masterfrom
Conversation
cirq.map_operations and cirq.map_operations_and_unroll
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6250 +/- ##
=======================================
Coverage 97.60% 97.60%
=======================================
Files 1116 1116
Lines 95768 95848 +80
=======================================
+ Hits 93476 93556 +80
Misses 2292 2292
☔ View full report in Codecov by Sentry. |
Collaborator
|
could you explain the change in the description? also what is happening with the mypy script? |
Collaborator
Author
|
@NoureldinYosri Added a detailed description and the change to mypy script was a mistake so I've reverted it. |
NoureldinYosri
approved these changes
Aug 18, 2023
Collaborator
NoureldinYosri
left a comment
There was a problem hiding this comment.
LGTM. just a few nits and documentation
harry-phasecraft
pushed a commit
to PhaseCraft/Cirq
that referenced
this pull request
Oct 31, 2024
…uantumlib#6250) * Speed up cirq.map_operations and cirq.map_operations_and_unroll * Mypy typing and minor bug fixes * Fix pylint * Revert unrelated change to mypy script * Address nits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6173
Part of #6097
This leads to a roughly
~4-5ximprovement in performance forcirq.map_operationsandcirq.map_operations_and_unroll. See #6173 (comment) for a detailed use-case specific analysis.The primary reason behind the speedup is to get rid of repeated instantiations of
cirq.Circuit, which was being done for once for every call tomap_func(op, i). The intermediate circuits were constructed mainly for circuit alignment. This PR instead uses the circuit construction strategy similar to the one used inCirq/cirq-core/cirq/circuits/circuit.py
Line 1760 in 95c672a
cirq.Circuitconstructor only once at the end.