Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 28, 2020

This is an automated backport of pull request #4958 done by Mergify

Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the simulator.

Finally, you can contact us on https://mergify.io/

* Make ipython detection occur at runtime

Importing IPython takes at least >150ms and is only used directly in one
function (and then only if it's in jupyter). This is a pretty heavy
import to run unconditionally at the module level, because we end up
wasting time if IPython is installed even if we're not inside jupyter
confirming the module is present despite never being able to use it.
This commit moves it to runtime to avoid inside the function to avoid
this import penalty, it will add som small overhead to the function but
since its not performance critical this is a fine tradeoff.

* Move PassManager.draw() visualization import to runtime

This commit moves the import of the qiskit visualization module for the
pass manager drawer from the module level in
qiskit.transpiler.passmanager to a run time import in the draw() method.
The visualization module import time is fairly heavy (when matplotlib is
installed) because of its usage of matplotlib. By having the import at
the module level this forces this import time penaly on just a bare
import of qiskit even if no visualization is going to be used. This is
because the passmaanger gets pulled in from the top level namespaces of
qiskit. To avoid this unecessary overhead this makes it a runtime import
so unless you go to use the passmanager.draw() method it won't be
imported. This will add some overhead to the draw() method (especially
if matplotlib hasn't already been imported) but since visualization
methods aren't performance critical and are typically quite slow this
isn't a a problem.

* Fix docs build

* Revert "Move PassManager.draw() visualization import to runtime"

Moving the visualization import to runtime has a backwards compatibility
issue in that the visualization module is no longer imported as part of
qiskit. This can potentially break users since visualization
functionality would be present without a second import. This reverts
this change to avoid that breaking change. A follow-on PR will try to
address the import time performance from matplotlib in a different way.

This reverts commit bcdb37f.

* Revert "Fix docs build"

This reverts commit 2967f0b.

Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 4cbc751)
@mergify mergify bot requested review from maddy-tod, nonhermitian and a team as code owners August 28, 2020 22:58
@mergify mergify bot merged commit d01399f into stable/0.15 Aug 31, 2020
@mergify mergify bot deleted the mergify/bp/stable/0.15/pr-4958 branch August 31, 2020 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant