forked from Qiskit/qiskit
-
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.
Remove deepcopy usage from dag/circuit converters
In Qiskit#1816 as part of the larger restructure the dag_to_circuit() and circuit_to_dag() converter were modified to use a copy.deepcopy() instead of native Instruction/Gate constructors. This caused a large performance regressions (around 3x in the worst case) in certain transpile calls. To avoid this performance penalty this commit reintroduces a private function to call the class constructor for each input gate to create a new instance of the object to append to the output. This removes the deepcopy usage and should fix the performance regression. Fixes Qiskit#2131
- Loading branch information
Showing
2 changed files
with
61 additions
and
7 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