forked from quantumlib/Cirq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up circuit building by not forgetting about cached objects (qua…
…ntumlib#5280) This speeds up a 10^2 qubit by 10^3 deep creation of a circuit made up entirely of `cirq.X` gates, created by just appending these gates onto the circuit, from 25s to 5s. The issue is that Moment's are immutable, so they need to be copied when adding in new operations. Before this PR we don't copy two cached objects, the measurement key objects, and control keys during this. This copies these caches over and update them. Because using `insert` on circuit for earliest insertion strategy has to look up measurement keys or control keys (in order to not move an object with such a key before a moment that has such a key), moments during creating are always being asked what their measurement and control keys are.
- Loading branch information
Showing
3 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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