-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new
Interner
merging in DAGCircuit::from_circuit
This converts one obvious candidate for the new interner-merging functionality. There are several others in the codebase (all uses of `DAGCircuit::extend`, for example, and several other full rebuilds), but the structure of their code wasn't designed with this in mind, so the modifications would typically be far more involved and more suitable for separate patches. Using a timing script: ```python import itertools from qiskit.circuit import QuantumCircuit from qiskit.converters import circuit_to_dag qc = QuantumCircuit(100, 100) for pair in itertools.permutations(qc.qubits, 2): qc.rz(0, pair[0]) qc.sx(pair[0]) qc.rz(0, pair[0]) qc.rz(0, pair[1]) qc.sx(pair[1]) qc.rz(0, pair[1]) qc.cx(*pair) %timeit circuit_to_dag(qc, copy_operations=False) ``` this patch showed an improvement from 18.5(6)ms to 14.4(5)ms on my machine, which is a 22% speedup, though admittedly this particular function was doing larger-scale allocation work that could be removed than other candidate replacements are.
- Loading branch information
1 parent
2677160
commit d825e9f
Showing
1 changed file
with
110 additions
and
50 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