Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache dag qubits/clbits #4535

Merged
merged 4 commits into from
Jun 9, 2020
Merged

Conversation

ajavadia
Copy link
Member

@ajavadia ajavadia commented Jun 2, 2020

Fixes #4484

The list of qubits and clbits of a dag were being recreated every time dag.qubits() and dag.clbits() methods were called, which was slow. Here I make them cached properties. Being properties is also aligned with how they are in QuantumCircuit.

@ajavadia ajavadia requested review from maddy-tod, nonhermitian and a team as code owners June 2, 2020 17:48
@ajavadia ajavadia added Changelog: Deprecation Include in "Deprecated" section of changelog performance stable backport potential The bug might be minimal and/or import enough to be port to stable labels Jun 2, 2020
@mtreinish mtreinish added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Jun 4, 2020
@kdk kdk added the automerge label Jun 8, 2020
@mergify mergify bot merged commit 01cc5a2 into Qiskit:master Jun 9, 2020
mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Jun 9, 2020
* cache dag.qubits and dag.clbits

* releasenotes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
(cherry picked from commit 01cc5a2)

 Conflicts:
	qiskit/dagcircuit/dagcircuit.py
        qiskit/dagcircuit/dagdependency.py
	test/python/dagcircuit/test_dagdependency.py
mtreinish added a commit that referenced this pull request Jun 10, 2020
* Cache dag qubits/clbits (#4535)

* cache dag.qubits and dag.clbits

* releasenotes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
(cherry picked from commit 01cc5a2)

 Conflicts:
	qiskit/dagcircuit/dagcircuit.py
        qiskit/dagcircuit/dagdependency.py
	test/python/dagcircuit/test_dagdependency.py

* Remove deprecation warning for new properties

The deprecation for the use of the qubits and clbits properties as
methods doesn't start to 0.15.0, for the 0.14.x it isn't deprecated and
the caching is backported to just fix the performance bug. This commit
removes the deprecation warning and the release note so the deprecation
timer doesn't actually start until 0.15.0.

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
@kdk kdk mentioned this pull request Jul 21, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
* cache dag.qubits and dag.clbits

* releasenotes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog Changelog: Deprecation Include in "Deprecated" section of changelog performance stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transpile Performance Regression
3 participants