Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid deepcopy in sabre_swap (#5316)
This commit changes the deepcopy usage in the sabreswap pass to a shallow copy. In sabre_swap the deepcopy was run on the DAGCircuit node when remapping it, however this was not necessary because it's not actually used where shared references matter. The output from the remapper is not used directly and instead a copy of the DAGNode object is just used as a container for the required args in apply_operation_back() where a new DAGNode is always created from the op, qargs, etc. The remapping just replaces the qargs parameter with the remapped one. So this commit changes the deepcopy to a shallow copy which won't have the performance overhead. Fixes #5197 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information