Skip to content

Conversation

mtreinish
Copy link
Member

Summary

Just as has been demonstrated many times in the past we should not be
importing sympy at the module level. In #5259 another import was added
and was immediately flagged as an import speed regression [1]. Sympy is
a very heavy dependency and is slow to import (and slow to run too).
Adding a sympy import to the module level makes and is honestly a
dependency we should be reluctant to add anywhere because it becomes
the primary bottleneck whenever it is used. This commit removes the top
level sympy import and moves to be a runtime import in the single method
that uses sympy. Just as it was done in #5149, #4385, and #3156 before.

Details and comments

[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=b5d5a3bb

Just as has been demonstrated many times in the past we should not be
importing sympy at the module level. In Qiskit#5259 another import was added
and was immediately flagged as an import speed regression [1]. Sympy is
a very heavy dependency and is slow to import (and slow to run too).
Adding a sympy import to the module level makes and is honestly a
dependency we should be reluctant to add anywhere because it becomes
the primary bottleneck whenever it is used. This commit removes the top
level sympy import and moves to be a runtime import in the single method
that uses sympy. Just as it was done in Qiskit#5149, Qiskit#4385, and Qiskit#3156 before.

[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=b5d5a3bb
@mergify mergify bot merged commit 75c6fd1 into Qiskit:master Nov 20, 2020
@mtreinish mtreinish deleted the remove-sympy-again branch November 20, 2020 12:29
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Jan 4, 2021
Just as has been demonstrated many times in the past we should not be
importing sympy at the module level. In Qiskit#5358 another import was added
and was immediately flagged as an import speed regression [1]. Sympy is
a very heavy dependency and is slow to import (and slow to run too).
Adding a sympy import to the module level makes and is honestly a
dependency we should be reluctant to add anywhere because it becomes
the primary bottleneck whenever it is used. This commit removes the top
level sympy import and moves to be a runtime import in the single method
that uses sympy. Just as it was done in Qiskit#5416, Qiskit#5149, Qiskit#4385, and Qiskit#3156
before.

Fixes Qiskit#5575

[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=300e9507
kdk pushed a commit that referenced this pull request Jan 4, 2021
Just as has been demonstrated many times in the past we should not be
importing sympy at the module level. In #5358 another import was added
and was immediately flagged as an import speed regression [1]. Sympy is
a very heavy dependency and is slow to import (and slow to run too).
Adding a sympy import to the module level makes and is honestly a
dependency we should be reluctant to add anywhere because it becomes
the primary bottleneck whenever it is used. This commit removes the top
level sympy import and moves to be a runtime import in the single method
that uses sympy. Just as it was done in #5416, #5149, #4385, and #3156
before.

Fixes #5575

[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=300e9507
@kdk kdk added the Changelog: None Do not include in changelog label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants